2 of 43
2
plugin: Image Sizer
Posted: 18 October 2007 06:38 PM   [ Ignore ]   [ # 19 ]  
Lab Assistant
Avatar
RankRank
Total Posts:  134
Joined  03-10-2005

ssouci
based on your earlier post the variable {image_big} is outputting

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

and you are placing this in your template

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

so by combining {image_big} with the imgsizer plugin you are creating basically this tag

{exp:imgsizer:size image="/images/uploads/<img src="{filedir_1}carluccio_a_completemushroombook_200w.jpg" style="border0;" alt="image" width="200" height="250" />" width="50" alt="image"

no that wont work

 Signature 

David Rencher  lumis.com

Profile
 
 
Posted: 18 October 2007 06:46 PM   [ Ignore ]   [ # 20 ]  
Lab Technician
Avatar
RankRankRankRank
Total Posts:  2020
Joined  08-04-2002

That’s where ExtractURL-Plus comes in, it extracts just the image.ext from the {image_big} field.

Profile
 
 
Posted: 18 October 2007 07:10 PM   [ Ignore ]   [ # 21 ]  
Lab Assistant
Avatar
RankRank
Total Posts:  134
Joined  03-10-2005

PXLated
yeah i understand that but i don’t think he was using that plug-in.
also to use a plug-in to set the param on a tag you need to use the parse=“inward” param

{exp:imgsizer:size image="/images-reading/{exp:extract_url_plus show="&#xf;i;lename.&#xe;x;tension"}{reading_imageFile}" width="150" alt="My Title" parse="inward"} 

Related thread

 Signature 

David Rencher  lumis.com

Profile
 
 
Posted: 18 October 2007 07:24 PM   [ Ignore ]   [ # 22 ]  
Lab Technician
Avatar
RankRankRankRank
Total Posts:  2020
Joined  08-04-2002

Sorry Lumis, I figured you understood, was directing that more to Ssouci…I should have specified :-(

Parse Inward…Hmmm, didn’t think of that. So used to using phpThumb where that doesn’t come into play. Thanks!

Profile
 
 
Posted: 22 October 2007 05:47 PM   [ Ignore ]   [ # 23 ]  
Grad Student
Rank
Total Posts:  97
Joined  03-01-2007

Lumis:

to answer your question, my image variables like this in the database:

EG:

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

I am uploading my images into the images/uploads directory using EE’s bult-in uploader, and it seems that EE inserts the http://ellislab.com/images/uploads/ variable (to replace the full path data)

thx

Profile
 
 
Posted: 22 October 2007 10:14 PM   [ Ignore ]   [ # 24 ]  
Lab Assistant
Avatar
RankRank
Total Posts:  134
Joined  03-10-2005

ssouci
http://ellislab.com/images/uploads/ could output anything depending on how you have it setup in your upload preferences. i believe it is “URL of Upload Directory” just set that to a relative path instead of a URL
http://www.domain.com/images/uploads/
to
/images/uploads/

but I updated the plug-in to deal with situations like this where someone would want to pass in the full URL. it will also now fetch remote images now and resize them.
give it a try and let me know

 Signature 

David Rencher  lumis.com

Profile
 
 
Posted: 23 October 2007 01:50 PM   [ Ignore ]   [ # 25 ]  
Summer Student
Avatar
Total Posts:  14
Joined  05-24-2007

lumis I was looking for a plugin like this.

I’ve readed the entire post and I’ve nothing more to say than a big THANK YOU for yor support.

Profile
 
 
Posted: 23 October 2007 03:06 PM   [ Ignore ]   [ # 26 ]  
Summer Student
Avatar
Total Posts:  14
Joined  05-24-2007

Well I’m having my first trouble with this plugin, and I think it’s because EE is installed inside a folder, not in the root folder.

My EE installation is in the directory /sitio/

So my templates are acceded like this

/sitio/index.php/template_group/template_name

I wrote the full image path instead of taking it from a variable just to be sure that the problem is not with the variables or how I’ve configured my upload dir.

The full image path is /sitio/images/covers/cod_83.jpg, so I wrote

{exp:imgsizer:size image="/sitio/images/covers/cod_83.jpg" width="170" justurl="yes"

That returns nothing…

But if I use the path without the installation dir (without /sitio):

{exp:imgsizer:size image="/images/covers/cod_83.jpg" width="170" justurl="yes"

The plugin returns the cached image URL, obviously without the installation dir:

/images/covers/cache/170x170-cod_83.jpg

So to fix that, I add the installation dir manually:

/sitio{exp:imgsizer:size image="/images/covers/cod_83.jpg" width="170" justurl="yes"

So the plugin returns:

/sitio/images/covers/cache/170x170-cod_83.jpg

It looks like I’ve solved the problem, but there is another: The image cache file doesn’t exist.

There is no /cache folder inside my /covers folder.

Maybe is because the plugin is trying to write it in /images/coves instead of /sitio/images/covers.

The weird thing is that it seems like the plugin is adding the /sitio folder to the image path, because it can find it and read it well, but it’s not able to write it to the correct destination folder.

Any Help?

Profile
 
 
Posted: 26 October 2007 12:47 PM   [ Ignore ]   [ # 27 ]  
Lab Technician
Avatar
RankRankRankRank
Total Posts:  1757
Joined  03-26-2006

Has this plugin been updated so that height is the determining factor in the resize? I have a layout where I really need to restrict by height - but everywhere else on the site I need to restrict by width, which this apparently does. I’d hate to have to install this for everything but that one page, where I’d have to install phpThumb just to restrict by height.

Thanks for working on a simple(r) alternative to phpThumb, which is, in many case, overkill.

 Signature 

ryan masuga
—————
Masuga Design | devot:ee
@masuga | @masugadesign | @devot_ee

Profile
 
 
Posted: 31 October 2007 05:34 PM   [ Ignore ]   [ # 28 ]  
Lab Assistant
Avatar
RankRank
Total Posts:  219
Joined  10-24-2006

Hi there - Looks like a great plugin!

We’re currently using PhpThumb to resize images, and it’s killing our server when we get too much traffic.  Is this plugin more efficient than PhpThumb?

Thanks again!

 Signature 

dabbledoo.com | .(JavaScript must be enabled to view this email address)

Member of the EE Pro Network

Profile
 
 
Posted: 31 October 2007 06:49 PM   [ Ignore ]   [ # 29 ]  
Lab Assistant
Avatar
RankRank
Total Posts:  134
Joined  03-10-2005

updated v1.5

* now uses Expression Engines Image Library instead of just the GD library so any image processor setup in the EE control panel will work.
* resizing can be done by ether width or height
* images keep there default format instead of all being converted to jpg
* mime type check makes sure mime types match ok types
* combined the tag pair into the default tag so it can be a tag pair or a single depending on how you want the output
* the pathing to the image location is now based on server vars and not relative paths
* cache directory is created automatically if it is not on the server

src= (required) the path from “webroot” to the image or the URL to the image
  /images/news/moped.jpg or http://www.lumis.com/images/news/moped.jpg

width= the width you wish the image to resized to. the height is resized proportionately
    or
height= the height you wish the image to resized to. the width is resized proportionately
    note: if you use width and height width will take president

justcheck
= (Single Tag only) if set to yes the tag will return a 1 if the image exists
justurl= (Single Tag only) if set to yes the tag will only return the path to the image
alt= (Single Tag only) the alt tag of the image
id= (Single Tag only) the id of the image

 

Single Tag:

{exp:imgsizer:size src="/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" /> 

Tag Pair:

{exp:imgsizer:size src="/images/news/moped.jpg" width="100"}
       
<img src="{url}" width="{width}" height="{height}" />
       <
div style="background-image:url({url}); width:{width}px; height:{height}px;"></div>
  
{/exp:imgsizer:size} 
 Signature 

David Rencher  lumis.com

Profile
 
 
Posted: 31 October 2007 07:49 PM   [ Ignore ]   [ # 30 ]  
Lab Technician
Avatar
RankRankRankRank
Total Posts:  2020
Joined  08-04-2002

Wow Lumis, you’ve been busy!!! Will be trying it out as soon as I get a break.

Profile
 
 
Posted: 01 November 2007 12:12 AM   [ Ignore ]   [ # 31 ]  
Lab Technician
Avatar
RankRankRankRank
Total Posts:  2020
Joined  08-04-2002

I would imagine it would have the same issue as phpThumb if it has to check for a cache file on every page load. It would probably have to in case you’ve changed a parameter.

Profile
 
 
Posted: 01 November 2007 12:20 AM   [ Ignore ]   [ # 32 ]  
Lab Assistant
Avatar
RankRank
Total Posts:  134
Joined  03-10-2005

well it would depend on what your idea of busy is? but i use it here with no problems http://wkrg.com/ every article we do has multipul different image sizes. and i cant give out exact numbers but it handels well over a million page views a month. and at peek times over 6000 users on the site at one time.

I have also built Gallery sections using this plug-in you can view here   http://wkrg.com/weather_gallery/

I have a companion plug-in im working on to display images in the edit list and resizing / cropping tab in the publish page

ohh and the check cache feature is a simple if cache file exists then dont do any processing and just return the url

 Signature 

David Rencher  lumis.com

Profile
 
 
Posted: 01 November 2007 12:29 AM   [ Ignore ]   [ # 33 ]  
Summer Student
Avatar
Total Posts:  14
Joined  05-24-2007
PXLated - 01 November 2007 04:12 AM

I would imagine it would have the same issue as phpThumb if it has to check for a cache file on every page load. It would probably have to in case you’ve changed a parameter.

Does that really have performance issues?

I’ll try the new version in a website, It has had about 18000 template hits in the last two weeks. And I have the template cache activated.

Will the plugin slow down the website?
What if I just use the justurl parameter (obviously after the image has been resized and cached)?
Does EE have any method to save the plugin’s output in the cache? Or any way to notice the plugin in case EE is using a cached version of a template?

Sorry for my english smile

lumis, thank you again for the great support you are givin to this plugin!

Profile
 
 
Posted: 01 November 2007 12:38 AM   [ Ignore ]   [ # 34 ]  
Lab Technician
Avatar
RankRankRankRank
Total Posts:  2020
Joined  08-04-2002

With phpThumb it’s been reported by a couple as slowing down their site but only where there are tons of images on each page so it’s making the cache call many times over. And the speed comparison is in relation to using standard static thumbs rather than dynamic. I haven’t heard any problems for normal sites with a small number of images per page.

Profile
 
 
Posted: 01 November 2007 12:47 AM   [ Ignore ]   [ # 35 ]  
Lab Assistant
Avatar
RankRank
Total Posts:  134
Joined  03-10-2005

template caching and tag caching work fine. The plug-in will obey boath, actually that is EE it just does not process the plug-in again if eather are cached untill the cache expires.

justurl still does the same thing but it just returns the url/path to the image rather than all the other img code

the caching works like this:
is there a cached version for the size? (simple php file exists check)
yes
is cached version newer than original (simple file time comaprison)
yes
return url

so if eather of thoes above were no then it would make a resized cached version of the image
so really the php overhead is very very low unless resizing is needed but the resizing is really lightweight as well

also i have not looked at phpThumb but allot of applications like this actually return the cached file as a data-stream setting its own header as a image type and returning itself as the image. meaning the aplication would have to stream the entire image through itself each time it is loaded, rather than just returning itself as a file path.

 Signature 

David Rencher  lumis.com

Profile
 
 
Posted: 01 November 2007 01:04 AM   [ Ignore ]   [ # 36 ]  
Summer Student
Avatar
Total Posts:  14
Joined  05-24-2007
lumis - 01 November 2007 04:47 AM

template caching and tag caching work fine. The plug-in will obey boath, actually that is EE it just does not process the plug-in again if eather are cached untill the cache expires.

justurl still does the same thing but it just returns the url/path to the image rather than all the other img code

the caching works like this:
is there a cached version for the size? (simple php file exists check)
yes
is cached version newer than original (simple file time comaprison)
yes
return url

so if eather of thoes above were no then it would make a resized cached version of the image
so really the php overhead is very very low unless resizing is needed but the resizing is really lightweight as well

also i have not looked at phpThumb but allot of applications like this actually return the cached file as a data-stream setting its own header as a image type and returning itself as the image rather than just returning itself as a file path.

Ok thank you, now it’s more clear how EE and the plugin works.

I’ll try the new plugin version tomorrow.

Good night!

Profile
 
 
   
2 of 43
2