We use cookies to improve your experience. No personal information is gathered and we don't serve ads. Cookies Policy.

ExpressionEngine Logo ExpressionEngine
Features Pricing Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University
Log In or Sign Up
Log In Sign Up
ExpressionEngine Logo
Features Pro new Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University Blog
  • Home
  • Forums

plugin: Image Sizer

Development and Programming

mhulse's avatar
mhulse
329 posts
16 years ago
mhulse's avatar mhulse

Noregt,

What does “{bestand}” output all by itself?

Are you using the MH File extension?

I was using the MH File extension…

Long story short, I had major problems when doing:

{exp:img:sizer image="{custom_file_field}" ... }

The default return for the MH File extension is the absolute path ()…

The fix for me was this:

{exp:imgsizer:size src="/mm/images/uploads/{image-02}{custom_file_field}{/image-02}" auto="586"}...{/exp:imgsizer:size}

Which just output the image name… As you can see, I hard coded the root relative path.

Hehe, sometimes I learn the hard way… The image sizer plugin likes the root relative one instead. 😊

Not saying that is your problem though…

M

       
noregt's avatar
noregt
360 posts
16 years ago
noregt's avatar noregt
If you assign both a width and a height in Image Sizer it will scale down as close as possible and then crop it to that size.

Are you really, really sure that is standard behavior? It would mean that as a standard one would lose part of the image if the orientation is not the same as the height/width setting.

Have you tried this on your installation? It is exactly this that I do NOT want to happen.

PS; using auto should be a solution then, but doesn’t work either.

I could try the tag pair, to see if that matters.

       
mhulse's avatar
mhulse
329 posts
16 years ago
mhulse's avatar mhulse

Looks like this will not matter (having just now looked at the PHP)…

But the docs say “src” instead of “image”, but I think either will work.

{exp:imgsizer:size src="/images/news/moped.jpg" width="100"}
src= (required) the path from “webroot” to the image or the URL to the image. /images/news/moped.jpg or

^^^ Sounds like the absolute path is OK (the “… OR ” part)? I personally had problems using an absolute URL on my server.

       
ImpGabe's avatar
ImpGabe
171 posts
16 years ago
ImpGabe's avatar ImpGabe

From Lumis himself for version 2.1

mr_dimsum it scales the image proportionally then trims the longer of the sides to stay within the supply params depending on your width and height
       
noregt's avatar
noregt
360 posts
16 years ago
noregt's avatar noregt

Well, if the path would be wrong, I would not have any image at all.

Tried ‘src’, hoping it wouyld make a difference, but it didn’t.

       
ImpGabe's avatar
ImpGabe
171 posts
16 years ago
ImpGabe's avatar ImpGabe

Now I just want to make totally sure that you tried just assigning a width OR a height and left the other attribute off. No using auto or anything like that.

Have you done this?

       
noregt's avatar
noregt
360 posts
16 years ago
noregt's avatar noregt

I really did

From the PHP file:

width= the width you wish the image resized to. The height is resized proportionately. or height= the height you wish the image resized to. The width is resized proportionately. - if you use both width and height, width will take precedence

Cropping will only occur with equal sizes:

if “width” is = to “height” the image will be cropped from image center to make a square sized image.
       
ImpGabe's avatar
ImpGabe
171 posts
16 years ago
ImpGabe's avatar ImpGabe

I only asked if you did it because after you said you did I asked for the code and the code you showed me had both width and height assigned in it.

It appears that the instructions you quote are either for the Pairs Tag or are for a version before 2.1. In version 2.1 Lumis added the ability to crop thumbnails that are rectangular. To do this you assign a width and a height and the sizer scales it down proportionally and then crops off the longer attribute.

Any chance you could show us a bit more of the code, like the img with the containing elements. Perhaps even the exp tag?

       
mhulse's avatar
mhulse
329 posts
16 years ago
mhulse's avatar mhulse
Well, if the path would be wrong, I would not have any image at all.

Humor me… Can you make sure the path you input is from you web root, and not from the www?

In other words… Web root:

/uploads/myimage.jpg

and not:

I had the WWW one work for some things, but not others… As soon as I made it root relative, all my problems went away. 😊

Any chance you could show us a bit more of the code, like the img with the containing elements. Perhaps even the exp tag?

Agreed.

Also, what does your image tag output by itself?

       
noregt's avatar
noregt
360 posts
16 years ago
noregt's avatar noregt

This bare bones template:



you can see the output here

A bit erratic behavior.. some work and some don’t.

The first one has this field: https://ellislab.com/asset/images/team-photo/novaz_dsc_7024.jpg

remobing teh wodth and height properties does help

       
ImpGabe's avatar
ImpGabe
171 posts
16 years ago
ImpGabe's avatar ImpGabe

Looks like it’s all doing what it’s supposed to except not sure about the tag pair images. Any idea why there are two for each entry?

Other than that, you can see that where you gave it both attributes it scaled and cropped (single tag, tag pair -although not sure why the second one is square, tag pair with div, and equal sizes). This is now the default behavior for image sizer as of 2.1.

Auto takes the number and applies it to the larger attribute (height for portrait images and width for landscape) and scales with no cropping.

And width only and height only applies it to that attribute and scales accordingly with no cropping.

This is actually a very nice example of what all the parameters do.

Now if you are still having an issue, we may need to figure out what exactly you want to use image sizer for in your layout.

What exactly are you wanting to do with it? What I mean is what are the images used for and how are they fitting in to the layout?

       
noregt's avatar
noregt
360 posts
16 years ago
noregt's avatar noregt

Now there’s an issue in combination with EE.

I use imgsizer as a way of resizing images that users upload. If you upload an image, EE will automatically place width and height attributes in the field like this:

https://ellislab.com/asset/images/team-photo/novaz_dsc_6826.jpg

If you now look at the test page, none of the images resize correctly. It’s all cropping. In some cases it does resize the width, but then cuts off height.

I can’t expect all users to manually remove these attributes? Imgsizer does remove the attributes from the field, but then slips up with the resizing.

Further more, the statement:

width= the width you wish the image resized to. The height is resized proportionately…- if you use both width and height, width will take precedence

is from 2.1.2, so either is does not work like it should or the comments are outdated?

       
noregt's avatar
noregt
360 posts
16 years ago
noregt's avatar noregt

I solved it for now by replacing the imgsizer with an older version (1.6.5). On the test page you can see that it now behaves like it should, even with height and width set by EE.

       
Erin Dalzell's avatar
Erin Dalzell
790 posts
16 years ago
Erin Dalzell's avatar Erin Dalzell

This doesn’t work:

{exp:imgsizer:size src="http://farm3.static.flickr.com/2148/2176424452_46d7eb6702.jpg"}

This does:

http://farm3.static.flickr.com/2148/2176424452_46d7eb6702.jpg

Any ideas?

       
Sue Crocker's avatar
Sue Crocker
26,054 posts
16 years ago
Sue Crocker's avatar Sue Crocker

Erin, imgsizer is meant to resize local images, not images elsewhere on the net.

       
First 23 24 25 26 27 Last

Reply

Sign In To Reply

ExpressionEngine Home Features Pro Contact Version Support
Learn Docs University Forums
Resources Support Add-Ons Partners Blog
Privacy Terms Trademark Use License

Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.