Help with aspect ratio
Posted: 26 November 2008 12:17 PM   [ Ignore ]  
Lab Technician
Avatar
RankRankRankRank
Total Posts:  2069
Joined  06-01-2007

I’m litte lost with this. i need to make images smaller and im doing it with css. But i dont know how to do this that it will keep the right aspect ratio on both cases, 600x400pixels and 400x600pixels. Im the worst ever in calculating or figuring these kind of things out so help would be more than welcome, thanks.

The target size should be 300px width or 300px height, keeping the aspect ratio in both cases.

- tuittu

 Signature 

Yep - im addicted to EE, what can i say more!
EE Commercial 1.6.7 Build: 20090515   | EE forum 2.1.1 Build (20090320) | EE MSM 1.1 Build: 20081024 + some Solspace modules!

Profile
 
 
Posted: 26 November 2008 12:28 PM   [ Ignore ]   [ # 1 ]  
Research Scientist
Avatar
RankRankRankRankRankRank
Total Posts:  9254
Joined  04-15-2006

Hiya,

First of all I would suggest not doing this in CSS as the end user still then has to download the larger size image which in certain cases might slow down your page considerably.

You could probably use the Image Sizer plugin to do this for you though couldn’t you? Easiest way would be if your images are entries in a weblog and then that way you can have a format field where you choose either Landscape or Portrait from a drop-down. You can then use this in a template to put the correct Image Sizer Plugin code in to re-size the image automatically for you.

Don’t know if that helps maybe?

Best wishes,

Mark

 Signature 

Shopping Cart Plugin
Full list of add-ons
———————————————————-
Buy me a drink, or two if you like!!

Profile
 
 
Posted: 26 November 2008 12:34 PM   [ Ignore ]   [ # 2 ]  
Lab Technician
Avatar
RankRankRankRank
Total Posts:  2069
Joined  06-01-2007

Thats the fastest way i think, but i always try to survive without plugins. This time it might come handy.

Thanks for the idea.

Cheers:
- Tuittu

 Signature 

Yep - im addicted to EE, what can i say more!
EE Commercial 1.6.7 Build: 20090515   | EE forum 2.1.1 Build (20090320) | EE MSM 1.1 Build: 20081024 + some Solspace modules!

Profile
 
 
Posted: 26 November 2008 12:45 PM   [ Ignore ]   [ # 3 ]  
Lab Technician
Avatar
RankRankRankRank
Total Posts:  2069
Joined  06-01-2007

Heh, just came to my mind that why just use the filemanager to handle this =) From there everything should be done without any hazzzzzzle. Or did i remember wrong =)

Cheers:
- Tuittu

 Signature 

Yep - im addicted to EE, what can i say more!
EE Commercial 1.6.7 Build: 20090515   | EE forum 2.1.1 Build (20090320) | EE MSM 1.1 Build: 20081024 + some Solspace modules!

Profile
 
 
Posted: 26 November 2008 12:53 PM   [ Ignore ]   [ # 4 ]  
Research Scientist
Avatar
RankRankRankRankRankRank
Total Posts:  9254
Joined  04-15-2006

Hiya,

Not too sure which filemanager you mean but using a plugin for this I would say is definitely the best way to go. I know you say that you prefer not to use them but honestly this would really be the best way to handle this type of situation.

The plugin doesn’t add any overhead to your system and will also allow you to change the image size at a moments notice in the future should you decide upon that.

Best wishes,

Mark

 Signature 

Shopping Cart Plugin
Full list of add-ons
———————————————————-
Buy me a drink, or two if you like!!

Profile
 
 
Posted: 26 November 2008 03:10 PM   [ Ignore ]   [ # 5 ]  
Lab Technician
Avatar
RankRankRankRank
Total Posts:  2069
Joined  06-01-2007

i ment this EE core upload manager. There you can resize the images.

Cheers:
- Tuittu

 Signature 

Yep - im addicted to EE, what can i say more!
EE Commercial 1.6.7 Build: 20090515   | EE forum 2.1.1 Build (20090320) | EE MSM 1.1 Build: 20081024 + some Solspace modules!

Profile
 
 
Posted: 26 November 2008 05:18 PM   [ Ignore ]   [ # 6 ]  
Summer Student
Avatar
Total Posts:  13
Joined  10-23-2008

I think using the Image Sizer plugin is really a “no brainer” as once its set-up in the weblog entries tag, you only ever have to upload an image using the upload manager once, without having to try and remember what dimensions you need to resize the image to every time you upload a new one.

Its also great if ever you need to have differing sizes of the same image across your site. For example with a thumbnail version and also a “full size” version. You would just set up two different Image Sizer tags but only ever have to upload the one image.

Further to this, if your not the one who will be uploading the files and it gets left to a few different people then it makes life so much simpler in basically every way.

Image Sizer is one of those plugins I install with every expression engine install I do as chances are i’m going to need some dynamic image manipulation at some point.

Mark has linked to it, so I would get it, install it and have a play and if after that you choose not to use then fair call.

Profile
 
 
Posted: 27 November 2008 05:05 AM   [ Ignore ]   [ # 7 ]  
Grad Student
Avatar
Rank
Total Posts:  100
Joined  06-23-2008

That Image Sizer plugin seems to be very usefull.
I’ve checked to examples and here I have one question (since I cannot comment on that page I ask it here smile ), does it work with Photo Gallery?

Normally the plugin says that u most enter the path + image name file to display the image (this is normal) but can it work with the {image_thumb} tag of the Module?

 Signature 

If it doesn’t work on Windows, try it on a Mac, it will work for sure ^^

Profile
 
 
Posted: 27 November 2008 05:52 AM   [ Ignore ]   [ # 8 ]  
Summer Student
Avatar
Total Posts:  13
Joined  10-23-2008

I don’t know for certain but if in the {image_thumb} tag you have the url to the image then in theory it should work.

{exp:imgsizer:size src='{image_thumb}' width='xxx' height='xxx' alt='{title}' title='{title}' style='display:block'}

If {image_thumb} = http://www.example.com/images/example.jpg (or whatever the url to the image is)

OR

http://ellislab.com/images/uploads/example.JPG (where filedir_1 is the default “main image upload” directory. If when an image is uploaded you select the “placement option”, “URL only” this will automatically generate the correct code.)

Having not yet used the gallery module i don’t actually know how image upload works for it.

Hope thats in some way helpful!

Profile
 
 
Posted: 28 November 2008 04:21 PM   [ Ignore ]   [ # 9 ]  
Sr. Research Associate
Avatar
RankRankRankRankRank
Total Posts:  2592
Joined  08-28-2003

Why not just use EE to upload the file, then use EE to size the image, create a thumbnail, and create the appropriate link?

 Signature 

I’magramps
———
Honolulu, HI
———
Home | Old Hobby | New Hobby | Newer Hobby | Refurbished via CSS

Profile
 
 
   
 
 
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: 77575 Total Logged-in Users: 48
Total Topics: 101563 Total Anonymous Users: 25
Total Replies: 544413 Total Guests: 245
Total Posts: 645976    
Members ( View Memberlist )