Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

General Discussion

Brandon Brown
PLUS
Brandon Brown
Courses Plus Student 7,737 Points

Isn't picturefill a waste of time?

The point of picturefill is to load a smaller image when the bandwidth of a visitor is lower, or to do the opposite when an image is larger. Since screen size and bandwidth are completely unrelated items, it seems like this solution is extra work, extra markup, and impractical to apply to a site that is already created.

Yes we are assuming that a smaller screen means lower bandwidth, and in most cases that's probably close to correct, but why cant we just use something like this:

<img class="ourimage" src="img/smallestimage.png" alt="Image alt name">
/*larger screens, 600px and above */
@media only screen and (min-width: 600px) {
.ourimage {content:url("img/largerimage.png");}

Then just repeat that scaling up to however large we have. This is still solving the problem in the wrong way by attacking screen size instead of a .js solution to detect bandwidth, but it makes much more sense than using .js and inserting HUGE image tags on the DOM.

I have done this and it does work. I found the content:url css on stackoverflow. http://stackoverflow.com/questions/2182716/how-can-we-specify-src-attribute-of-img-tag-in-css

Any thoughts? I simply WILL NOT use picturefill unless it makes more sense to do so... Or if I want an extra js query, I would rather use one that detects bandwidth for the correct solution.

1 Answer

I don't see what picturefill has to do with bandwidth. It's an attempt to mimic the proposed picture element.

I think the point is to serve a small image to a small screen. Why serve a large desktop image to a small screen only to have it scaled down to fit on the small screen?

I think all the responsive image solutions are simply a temporary solution until the w3c is able to catch up to current needs. I believe they are working on 4 different proposals right now. One of them being the picture element. So until one of those is finalized and implemented widely in browsers we will have to use one of the current solutions.

I think that each has it's pro's and con's and what you use probably is going to depend a lot on project requirements.

Here's an article that should give you a lot to consider:
http://css-tricks.com/which-responsive-images-solution-should-you-use/