--> How To Serve Responsive Images On Your Site? | Experience Lab - Online business creation and development guide for bloggers and startups

How To Serve Responsive Images On Your Site?

Responsive Web Design (RWD) has now become one of the the most important web design techniques nowadays, and it provide the cornerstone for...




Responsive Web Design techniques






Responsive Web Design (RWD) has now become one of the the most important web design techniques nowadays, and it provide the cornerstone for modern mobile web development. Implementing a few RWD techniques to your blog can give it the edge it needed, nay deserved, to entice its mobile users to visit more often. So while we're on the subject of implementing RWD techniques, let's talk a bit about serving truly responsive images, because there are a couple issues every webmaster faces when dealing with images, responsively speaking.




Usually, Responsive Web Design has to with fluid images, i.e. images that resize themselves depending upon the users' screen size and resolution. They work fine for desktops and tablets, but the biggest problem with fluid images is, no matter what client the user has, the same image size will be sent to them. The user agent then resizes the image according to the specifications at hand. This can be a problem for mobile data connections, and can reduce load time on a mobile. You can, however, use a number of techniques to serve images of different sizes to user agents.


Picture Element in HTML 5



The <picture> element is set to become a standard for responsive images in HTML 5, and it will allow us to use multiple sources for a single image while deciding the source will be done depending on the screen size. The markup looks as follows;





<picture id="my_images">
   <source media="(min-width: 50em)" srcset="large1.jpg 1x, large2.jpg 2x">
   <source media="(min-width: 20em)" srcset="medium1.jpg 1x, medium2.jpg 2x">    
</picture>




Since HTML 5 hasn't been fully finalized, this element is still being proposed, and is in the testing phase. So it can't be used yet. You can, however, use a JavaScript library called Picture Fill to achieve the same effect. It makes use of span tags, and its markup looks something like this;





<span data-picture data-alt="Some ALT text">
        <span data-src="small.jpg"></span>
        <span data-src="medium.jpg" data-media="(min-width: 500px)"></span>
</span>




WordPress Plugins



If you have a WordPress website, then you're in luck, because there are various plugins you can use to do the job for you.







PHP Scripts



If you somewhat know your way around PHP, then you can use a custom third-party PHP script to deliver resized images to the user depending upon the users' screen size and resolution. This is by far one of the most stable ways to do the job, and is definitely better than using JavaScript to detect user agent, and render image accordingly.




One such script is the Adaptive Image. Adaptive Image is a small PHP script that detects user screen size and deliver the proper image for that screen size. It does not require the changing of your current <img> markup, but the implementation is rather intimidating for less tech-savvy users.



We'll cover the implementation of these PHP scripts in another post. But for now, you can try the other alternatives, and tell us about your experience with these simple, yet effective responsive web design techniques. Cheers :)

COMMENTS

Name

Affiliate Marketing,12,Announcement,34,Bing,9,Bitcoin,38,blog,7,Blogger Resources,42,Blogger Templates,4,blogger tricks,156,Blogging ethics,70,Blogging tips,198,Bugs and Errors,34,Business,9,Copyright Violation,9,CSS and HTMLTricks,95,Designs,8,drop down menu,7,eBook,12,Email Marketing,7,Events,30,Facebook,30,Facebook tricks,49,Google,157,Google AdSense,42,Google Analytics,7,Google Plus,51,Google Plus Tricks,38,Guest Posts,112,home,2,How To,77,Internet,1,JSON Feeds,25,Kitchen Recipes,2,Label Based Sitemap Themes,1,Make Money Online,108,Marketing,16,MBT Blogger Templates,7,Menus,1,News,146,Pages,1,Posts,10,presentations,15,Responsive,10,Reviews,7,SEO,307,Settings,6,Shortcode,15,Sitemap Themes,1,Social Media,155,Technology,7,Templates,1,Tips,2,Tools,1,Traffic Tips,80,Video,19,Web Designing,62,web hosting,18,Webmaster Tools,97,Widgets,199,wordpress,26,
ltr
item
Experience Lab - Online business creation and development guide for bloggers and startups: How To Serve Responsive Images On Your Site?
How To Serve Responsive Images On Your Site?
https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi3nRTFUcBMJAWykRzDV89gZaLF24eyOaNzRE0TZj2qDjYaCjEg_IL3sMaY1N_jzWazAcBuTh_6AnwJ_kj5jTbi7vobi9h6aNijT4xuUJ_21b74K_PvcwBccCyUUz1ZltQ6lIvnqg0oDX3_/s320/Responsive--web-design-techniques.jpg
https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi3nRTFUcBMJAWykRzDV89gZaLF24eyOaNzRE0TZj2qDjYaCjEg_IL3sMaY1N_jzWazAcBuTh_6AnwJ_kj5jTbi7vobi9h6aNijT4xuUJ_21b74K_PvcwBccCyUUz1ZltQ6lIvnqg0oDX3_/s72-c/Responsive--web-design-techniques.jpg
Experience Lab - Online business creation and development guide for bloggers and startups
https://www.experiencelab.info/2013/09/how-to-serve-responsive-images-on-your.html
https://www.experiencelab.info/
https://www.experiencelab.info/
https://www.experiencelab.info/2013/09/how-to-serve-responsive-images-on-your.html
true
2959477579779989044
UTF-8
Loaded All Posts Not found any posts VIEW ALL Readmore Reply Cancel reply Delete By Home PAGES POSTS View All RECOMMENDED FOR YOU LABEL ARCHIVE SEARCH ALL POSTS Not found any post match with your request Back Home Sunday Monday Tuesday Wednesday Thursday Friday Saturday Sun Mon Tue Wed Thu Fri Sat January February March April May June July August September October November December Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec just now 1 minute ago $$1$$ minutes ago 1 hour ago $$1$$ hours ago Yesterday $$1$$ days ago $$1$$ weeks ago more than 5 weeks ago Followers Follow THIS PREMIUM CONTENT IS LOCKED STEP 1: Share. STEP 2: Click the link you shared to unlock Copy All Code Select All Code All codes were copied to your clipboard Can not copy the codes / texts, please press [CTRL]+[C] (or CMD+C with Mac) to copy