1 of 28
1
plugin: Image Sizer
Posted: 04 October 2007 07:01 AM   [ Ignore ]  
Lab Assistant
Avatar
RankRank
Total Posts:  132
Joined  03-10-2005

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

<img src="/images/news/cache/200x134-moped.jpg" width="200" height="134" alt="My Title" class="entry_img" id="img_5334" />

you can Download here

 Signature 

David Rencher lumis.com
EE Twitter Search
EE Image Sizer
EE Flickr

Profile
 
 
Posted: 04 October 2007 01:05 PM   [ Ignore ]   [ # 1 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  305
Joined  01-23-2006

cool, looks like a nice alternative to phptumb

 Signature 

jeremy douglas media design | twitter

Profile
 
 
Posted: 04 October 2007 01:17 PM   [ Ignore ]   [ # 2 ]  
Research Scientist
Avatar
RankRankRankRankRankRank
Total Posts:  6191
Joined  08-04-2002
<img src="/images/news/cache/200x134-moped.jpg" width="150" height="255" alt="My Title" class="entry_img" id="img_5334" />

Cool…Be nice though if it included the width and height. If it doesn’t, the browser has to figure it out.

Profile
 
 
Posted: 04 October 2007 01:57 PM   [ Ignore ]   [ # 3 ]  
Lab Assistant
Avatar
RankRank
Total Posts:  132
Joined  03-10-2005

updated to V1.1
- Fixed a bug with recalling the image Cache
- now outputs the width and height in the image tag

 Signature 

David Rencher lumis.com
EE Twitter Search
EE Image Sizer
EE Flickr

Profile
 
 
Posted: 04 October 2007 04:40 PM   [ Ignore ]   [ # 4 ]  
Research Scientist
Avatar
RankRankRankRankRankRank
Total Posts:  6191
Joined  08-04-2002

That was quick :-)
Thanks, gonna give it a try tonight.

Profile
 
 
Posted: 05 October 2007 10:38 AM   [ Ignore ]   [ # 5 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  891
Joined  02-05-2002

Very nice plugin, lumis.

I’d love to this plugin have Tag Pairs for even more flexibility, example:

{exp:imgsizer image="/images/news/moped.jpg" width="120" justurl="yes"}

<img src="{url}" width="{width}" height="{height}" />

{/exp:imgsizer}

or use the image as a background image:

{exp:imgsizer image="/images/news/moped.jpg" width="120" justurl="yes"}

<div style="width:{width}px; height:{height}px; background:#fff url({url}) no-repeat;"></div>

{/exp:imgsizer}

Cheers!

 Signature 

Member of the EE Pro Network

Profile
 
 
Posted: 06 October 2007 02:10 AM   [ Ignore ]   [ # 6 ]  
Lab Assistant
Avatar
RankRank
Total Posts:  132
Joined  03-10-2005

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.

 Signature 

David Rencher lumis.com
EE Twitter Search
EE Image Sizer
EE Flickr

Profile
 
 
Posted: 06 October 2007 09:59 AM   [ Ignore ]   [ # 7 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  891
Joined  02-05-2002

Wow, thanks for the update!

 Signature 

Member of the EE Pro Network

Profile
 
 
Posted: 06 October 2007 10:27 AM   [ Ignore ]   [ # 8 ]  
Research Scientist
Avatar
RankRankRankRankRankRank
Total Posts:  6191
Joined  08-04-2002

I think what Victor is wanting is the ability to specify either the width or the height as the critical size and have the other scale in proportion. In general I find the width to be the critical factor but can see instances where it could be the height.

Profile
 
 
Posted: 07 October 2007 10:01 AM   [ Ignore ]   [ # 9 ]  
Research Assistant
RankRankRank
Total Posts:  348
Joined  07-04-2007

Are you planning on adding zoom-crop to this? It would be very handy for sites that have thumbnails all the same size.

Profile
 
 
Posted: 09 October 2007 04:58 PM   [ Ignore ]   [ # 10 ]  
Grad Student
Rank
Total Posts:  83
Joined  03-01-2007

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”

Profile
 
 
Posted: 10 October 2007 06:25 AM   [ Ignore ]   [ # 11 ]  
Lab Assistant
RankRank
Total Posts:  143
Joined  07-18-2007

ssouci, I did the exact same thing. Except with the direct approach I still didn’t get anything.

Lumis any thoughts? I’m running EE on my windows localhost with a stock install of apache.

Profile
 
 
Posted: 10 October 2007 07:54 AM   [ Ignore ]   [ # 12 ]  
Research Scientist
Avatar
RankRankRankRankRankRank
Total Posts:  6191
Joined  08-04-2002

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.

Profile
 
 
Posted: 10 October 2007 12:10 PM   [ Ignore ]   [ # 13 ]  
Lab Assistant
Avatar
RankRank
Total Posts:  132
Joined  03-10-2005

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

 Signature 

David Rencher lumis.com
EE Twitter Search
EE Image Sizer
EE Flickr

Profile
 
 
Posted: 10 October 2007 02:52 PM   [ Ignore ]   [ # 14 ]  
Grad Student
Rank
Total Posts:  83
Joined  03-01-2007

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: 

<img src="{filedir_1}carluccio_a_completemushroombook_200w.jpg" style="border: 0;" alt="image" width="200" height="250" />

any ideas?

thx!

Profile
 
 
Posted: 10 October 2007 04:56 PM   [ Ignore ]   [ # 15 ]  
Research Scientist
Avatar
RankRankRankRankRankRank
Total Posts:  6191
Joined  08-04-2002

The problem I’m having is very similar to ssouci…
—————
The custom field contains (standard insert through the EE file upload button) ...
< img src=“http://expressionengine.com/files/templates/screenshots/cp/1591399270.jpg” width=“473” height=“700” / >

—————
Beyond that, one can use other plugins to extract or convert that field data…
——-
ExtractURL will take that custom field and return the full path…
http://media.pmhclients.com/images-reading/0609810316.jpg
——-
ExtractURL-Plus has parameter so you can extract just the file name so you’d get…
0609810316.jpg

—————
What I do when using phpThumb is use the second within the phpThumb code…That gets me a cached thumbnail…

<img src="http://www.site.com/utilities/phpThumb/phpThumb.php?src=/images-reading/{exp:extract_url_plus show="&#xfi;lename.&#xex;tension"}{reading_imageFile}{/exp: extract_url_plus}&w=75" />

——-
For Image resizer to work for this scenario, it would either have to convert the file/path like Extract-URL and use that or allow one to use either ExtractURL or ExtractURL-Plus within the tag. With the later, the code would look like this…

{exp:imgsizer:size image="/images-reading/{exp:extract_url_plus show="&#xfi;lename.&#xex;tension"}{reading_imageFile}" width="150" alt="My Title"}
Profile
 
 
Posted: 18 October 2007 03:33 AM   [ Ignore ]   [ # 16 ]  
Lab Assistant
Avatar
RankRank
Total Posts:  107
Joined  07-06-2006

Hi there,

I’m having the same problem as rick.prince, but on a Unix server.

Both the single and pair tags aren’t outputting anything at all.

Any ideas? Really keen to use this as its a lot more streamline and tidier than phpThumb.

Cheers.

 Signature 

Erskine Design: http://www.erskinedesign.com

Profile
 
 
Posted: 18 October 2007 09:42 AM   [ Ignore ]   [ # 17 ]  
Lab Assistant
Avatar
RankRank
Total Posts:  132
Joined  03-10-2005

Sorry it is taking me so long to get back to you guys. but it is hard to tell whats going on with your setups if i cant see the input

basically the variables that you are putting in as the image, do they contain the full URL or just the relative path? Right now it has to be the path from your sites http root to the image.

for instance this will work.
/images/uploads/image.jpg

this will not work.
http://www.domain.com/images/uploads/image.jpg

however the new version i am working on will do images with full URL’s
i will possibly have a update today

 Signature 

David Rencher lumis.com
EE Twitter Search
EE Image Sizer
EE Flickr

Profile
 
 
Posted: 18 October 2007 03:48 PM   [ Ignore ]   [ # 18 ]  
Grad Student
Rank
Total Posts:  83
Joined  03-01-2007

it would be really great if I could simply insert my image variable, like in the example below where I inserted my image as {image_big}... am I hearing that this is not possible?

IE:

{exp:imgsizer:size image="/images/uploads/{image_big}" width="50" alt="image"}

(above code does not work)

all I want to do is to produce a smaller version of my images in certain situations (ie., like some sort of “auto thumbnail”)

thx!

Profile
 
 
   
1 of 28
1
 
Post Marker Legend
New Topic New posts Hot Topic Hot Topic with new posts New Poll New Poll Moved Topic Moved Topic Sticky Topic Sticky topic
Old Topic No new posts Hot Old Topic Hot Topic with no new posts Old Poll Old Poll Closed Topic Closed Topic Announcement Announcements
Theme
Change Theme
Visitor Statistics
The most visitors ever was 1149, on July 16, 2007 09:33 AM
Total Registered Members: 77482 Total Logged-in Users: 36
Total Topics: 101518 Total Anonymous Users: 20
Total Replies: 544254 Total Guests: 226
Total Posts: 645772    
Members ( View Memberlist )