Re: Background image cropping

On Jun 11, 2014, at 8:11 AM, Marat Tanalin <mtanalin@yandex.ru> wrote:

> 11.06.2014, 04:52, "Sylvain Galineau" <galineau@adobe.com>:
>> On Jun 10, 2014, at 5:30 PM, Marat Tanalin <mtanalin@yandex.ru> wrote:
>>>  Media Fragments could be used in CSS for some simplest cases, while pure-CSS solutions could be used as a more flexible and usable alternative when needed.
>>> 
>>>  For example, how would following expression be expressed in terms of Media Fragments?
>>> 
>>>     /* Here we have 4em-size center part of the image: */
>>>     -moz-image-rect(
>>>         calc(50% - 2em),
>>>         calc(50% - 2em),
>>>         calc(50% - 2em),
>>>         calc(50% - 2em)
>>>     )
>> 
>> In cases like this you'd need the full image to compute the result anyway, so it's not really a scenario for MF.
>> 
>> This thread started with background sprites as they are currently built on the web. Those can certainly use MF, though some syntactic sugar to build the fragment may be nice...
> 
> Based on whay you say, it looks like that Media Fragments cause a separate HTTP request for each region of the same image (one image => multiple HTTP requests).
> 
> This is the contrary to the main idea behind sprites that consists of uniting multiple images into a single image file to _minimize_ the number of HTTP requests (multiple images => one HTTP request).
> 
> If so, MF look like not suitable for the purpose of spriting at all.


I understand it is a lot more fun to jump to conclusions, but I would suggest reading the spec instead of deriving assertions from what you believe it 'looks like' I'm saying.

MF explicitly allows the user agent to apply the fragment part of the URI to the cached resource. 

In some cases, it will make sense for the browser to cache the resource and crop it locally. In other cases, it *may* be beneficial for the server to hand over the requested fragment. These capabilities are not mutually exclusive.

Received on Thursday, 12 June 2014 15:42:52 UTC