General Programming Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsProgrammingGeneral Programming Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old December 16th, 2002, 06:13 PM
Brian Rosner Brian Rosner is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jul 2002
Location: Denver, CO
Posts: 34 Brian Rosner User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 7
Send a message via ICQ to Brian Rosner Send a message via AIM to Brian Rosner Send a message via Yahoo to Brian Rosner
Constrain Proportions

I'm looking for some help on how contraint proportions work. I know when I want to resize a photo in Photoshop all I need to do is supply either the width or hieght and it will automatically determine the apporiate opposite size.

I have read through Ben's article on making thumbnails with PHP and GD, but it seems in that you have to supply both and then the script will determine the size.

Any help would be awesome. Thanks in advance!

Last edited by Brian Rosner : December 16th, 2002 at 06:32 PM.

Reply With Quote
  #2  
Old December 16th, 2002, 07:01 PM
Ben Rowe
Guest
Dev Articles Newbie (0 - 499 posts)
 
Posts: n/a  
Time spent in forums:
Reputation Power:
to keep the proportion of the iamge, you need to get the propotion of the resize side to the original side. so you do

pro = orgina_h/resized_h

pro would be say .09 to make it smaller, and 1.1 if you resized it bigger,

then you times the width of the original image by the pro

origina_w * pro

this would give you your resized image, keeping the proportion.

Reply With Quote
  #3  
Old December 16th, 2002, 07:04 PM
jpenn jpenn is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Oct 2002
Location: Washington, DC
Posts: 317 jpenn User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 m 3 sec
Reputation Power: 6
PHP Code:
/* $scale: Percentage to scale the image to */
$scale '10';

/* Make it work */
$size GetImageSize$image );
$width $size[0];
$height $size[1];
$scale $scale/100;
$newwidth round$width $scale );
$newheight round$height $scale );

/*
   Feed the above a 800x600 image and it should
   scale it to 80x60 when using 10% scale.
   Untested - might work - might not...
*/ 
__________________
~ Joe Penn

We work for free to help make this a valuable resource on the internet. Do you appreciate the help - did we provide help that will help you prosper and help that has contributed to sharpening your current skill set?

Show your appreciation and purchase something from our Amazon Wishlist's - it's simple and a great way to say thank you.




Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingGeneral Programming Help > Constrain Proportions


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 4 hosted by Hostway