Auto TinySrc WordPress Plugin
I’ve published a new WordPress plugin which I wrote for Ribot today, enabling anyone to use TinySrc on their site by simply adding it. Download it from WordPress.org.
TinySrc is a service provided by Sencha which dynamically shrinks your images according to the device accessing them. This helps shrink images for mobile, and will cut down the size of a site with a responsive design.
This plugin replaces all image tag src’s within your content with the tinysrc src (http://mysite.com/myimage.png becomes http://i.tinysrc.mobi/http://mysite.com/myimage.png), and provides a function to call in your themes to optimise those images.
To use the plugin, run through the following:
1. Upload `auto-tinysrc.php` to the `/wp-content/plugins/` directory
2. Activate the plugin through the ‘Plugins’ menu in WordPress
3. Place
get_tinysrc_image(‘image_url’);
} else {
echo image_url;
} ?>
in your templates to display any template images optimised, e.g.
if (function_exists(‘get_tinysrc_image’)) {
get_tinysrc_image($image_url);
} else {
echo $image_url;
} ?>
4. To get a variable containing the url of an image with the tinysrc url use
} ?>
-
brian
-
John Lopez
-
Andrew Nimm
