| Home | Register | FAQ | Members List | Search | Today's Posts | Mark Forums Read |
| DesignersTalk > Proportional resize of max-height and max-width... |
|
LinkBack | Thread Tools | Search this Thread |
|
|
#1 (permalink) |
|
Registered User
|
Proportional resize of max-height and max-width...
I have lots of images in different sizes. Some of them are too large and I want them to change their dimensions. So I've put: Code:
So if the image is 500px wide, It will reduce it's width to 325px. However, that will not influence the height of the image. That is my problem. I want images to proportionally resize. How can I achieve that? |
|
|
|
|
|
#4 (permalink) |
|
shiro
Join Date: Aug 2007
Location: Yokohama, Japan
Posts: 2,606
|
Write your style sheet as if it were a css sheet, adding in the php where you need it. Then save your sheet as .php Finally link to that sheet as you would a normal css sheet, and just put src="some_file.php" instead of src="some_file.css". Apparently that is. I've never done it, so I can't say for sure. But that's the word on the street. |
|
|
|
#6 (permalink) | |
|
Registered User
|
Quote:
No, that wouldn't work, I need this for wordpress theme on which I'm working on... |
|
|
|
|
#8 (permalink) |
|
Spare Parts
Join Date: Jan 2005
Location: Bracknell Forest
Posts: 4,961
|
PHP Code:
Then where the system is either saving down our outputting the URL replace <img src="mypic.jpg"> with <?php $outputimage=imageRestrict('mypic.jpg'); echo"$outputimage"; ?> Just rough idea. May need polishing. With a bit of thought you could do the maths and get a proportional height output. edit: tested - that works now. edit: the height calculates too. Last edited by datahound : 11-01-2008 at 19:09. |
|
|
|
#9 (permalink) |
|
Biscuit
Join Date: Jun 2006
Location: Ireland
Posts: 972
|
basically what you're doing is creating a thumbnail (a big one - same premise) Article - How to create thumbnails with PHP and gd. PHPit - Totally PHP » Image manipulation with PHP & the GD library, Part 2 all you need there "Get out of my face!"
"NO! I'll get in your FACE!" |
|
![]() |