This plugin will resize any JPG GIF or PNG image to the desired size specified in your EE tag and cache the resized image to the cache folder. If you update the original image a new resized version will be created. If the image is not on the server the tag will not return anything.
{exp:imgsizer:size image="/images/news/moped.jpg" width="200" alt="My Title" id="img_5334" class="entry_img"}
will output
/images/news/cache/200x134-moped.jpg
you can Download here
Cocoaholic new version 1.3 now has what you want the original tag still works but i added this
{exp:imgsizer:pair image="/images/news/moped.jpg" width="200"}
{url}
{width}
{height}
{/exp:imgsizer:pair}
Victor Im not really sure i know what you mean the width param is the scaling. the height is read from the original image and based on the scaling of the width the height is scaled proportionally to the width
maybe you are saying you would want to control the with and the height individualy? that would lead to squashed images etc. i just figured i would let the math figure that out.
Lumis:
could you please show an exact code sample of what I put into my template?
currently, I call up images in my posts simply by inserting the field name for my image… it’s called “image_big”, so I only have to insert the placeholder, ie: {image_big}
my images are all about 200px wide and are stored in the “images/uploads” directory right off my root
I want the images on my home page to appear as thumbs that are 50px wide
so… using the Resizer plugin, do I put in a line something like:
{exp:imgsizer:size image="/images/uploads{image_big}" width="50" alt="image"}
????? (the above code did not work at all)
also, I don’t have any “image ID”… what is that, and is it optional?
Note: I first downloaded the plugin, extracted zip, and placed the single .php file into my “plugins” directory using FTP
thx!
PS: as an experiment, I tried the plugin to try displaying one of my images files directly (ie, not using a variable placeholder like I want to do)…
I used the code:
{exp:imgsizer:size image="/images/uploads/cookinglight_200w.jpg" width="50" alt="My Title"}
my output page at least showed a small broken image of 50px wide, but I got the error: “Warning: imagejpeg() [function.imagejpeg]: Unable to open ‘images/uploads/cache/50x68-cookinglight_200w.jpg’ for writing in /home/cookbo2/public_html/system_ee123/plugins/pi.imgsizer.php on line 214”
I’m getting images with the direct link but can’t seem to get it working with extractURL or extractURL+ like one does with phpThumb. Would prefer to use this if we can get it working as it’s much lighter weight then phpThumb. phpThumb is somewhat overkill if all you need is image resizing/thumbnails.
ssouci the first try. because you did not get anything would make me think that /images/uploads{image_big} did not return the correct path to the image
the reason nothing would be returned would be that it could not find the original source image. Are you sure this would not be correct with the slash in front of {image_big}
{exp:imgsizer:size image="/images/uploads/{image_big}" width="50" alt="image"}
based on the error your second try returned i would assume you did not create a cache directory in your /images/uploads/ folder just make a cache folder /images/uploads/cache/ image ID is not required it just puts a id=”name” on the returned img code
rick.prince i don’t have access to a Windows setup to test this but i am willing to bet it is the way windows deals with paths. i will look into it.
PXLated can you explain how you are using extractURL+ to interact with image sizer
Lumis:
OK, I finally did get the second test to work (with image file specified directly)… this was done by creating a new directory called “cache” off my “images/uploads” directory as you explained
BUT, my primary test (to get images called up by a variable placeholder) is still not working
I used the line:
{exp:imgsizer:size image="/images/uploads/{image_big}" width="50" alt="image"}
this seems to be the correct path etc., but I get an error message:
Warning: getimagesize() [function.getimagesize]: Read error! in /home/cookbo2/public_html/system_ee123/plugins/pi.imgsizer.php on line 129 Warning: Division by zero in /home/cookbo2/public_html/system_ee123/plugins/pi.imgsizer.php on line 134 Warning: Division by zero in /home/cookbo2/public_html/system_ee123/plugins/pi.imgsizer.php on line 135 Fatal error: Call to undefined function: notfound() in /home/cookbo2/public_html/system_ee123/plugins/pi.imgsizer.php on line 191
NOTE: the variable “{image_big}” is a field name in my weblog database… a typical entry for this field in my edit screen looks like this:
https://ellislab.com/asset/images/team-photo/carluccio_a_completemushroombook_200w.jpg
any ideas?
thx!
Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.