28, May 2012

Suggestion for small change to Foto_upload class code - webmaster forum

 
Webdigity webmaster forums
[ Home | Help | Search | Forum's Shop | Archive | Login | Register | Webmaster Directory ]
Webdigity Webmaster Forums  >  Web Development  >  PhP  >  PHP classes @finalwebsites.com  >  Easy PHP Upload (Moderator: Olaf)
Topic: Suggestion for small change to Foto_upload class code
« previous next »
Pages: [1] Print
Instabuck - The easy way to sell digital products online

Author Topic: Suggestion for small change to Foto_upload class code  (Read 1574 times)
Just another rainy day
*
Posts: 1
10 credits
Members referred : 0


« on: Nov 12, 2006, 12:37:56 am »

I have been doing some work with photo uploading and resizing using Easy PHP Upload. It has preformed exaclty as needed but I have made one modification to the source and thought I should share it with the community.

The check_dimensions function within the Foto_upload class  uses a simple $x_check < $y_check to decide which side of the image should be sized down to its max setting. If an image is 1000px wide and 950px tall with max settings of 100 x 100 this works fine. It sees the image is wider than tall and sizes it down to 100px wide and 95 px tall.

The issue I have run into is that if you are working with max x and y values that are not equal this logic fails. The settings I am using are x_max at 100 and y_max at 60. If if a image happens to be 1000px wide and 950px tall, like before, the function still resizes the image to 100 x 95 leaving the y value above the set max.

The solution I am using is to choose which side to scale down to the max based on proportion:
      if( $this->x_max_thumb_size / $this->x_size > $this->y_max_thumb_size / $this->y_size ){
         //y stuff
      }else{
         //x stuff
      }
So instead of whichever side is bigger it chooses whichever side has a greater gap from it's max setting

What do you think? Is this a better way to go about it?
~Corey
Moderator
Community Supporter ?
Jedai Sword Master
*****
Gender: Male
Posts: 6691
34714 credits
Members referred : 374


It's time to use PHP5!


« Reply #1 on: Nov 12, 2006, 10:04:27 am »

Thanks Corey I will check that.

Trackback URI for this entry : http://www.webdigity.com/trackback.php?topic=4768
Tags : php Bookmark this thread : Digg Del.icio.us Dzone more....

Pages: [1] Print 
Webdigity Webmaster Forums  >  Web Development  >  PhP  >  PHP classes @finalwebsites.com  >  Easy PHP Upload (Moderator: Olaf)
Topic: Suggestion for small change to Foto_upload class code
« previous next »
Jump to:
User Area
Welcome, Guest. Please login or register.
Did you miss your activation email?
May 28, 2012, 03:46:53 pm





Login with username, password and session length

Donate to our community, and get a permanent link back to your site!

Donate to our community, and get a permanent link back to your site!






Web Design Gallery · Whois Lookup · Pagerank · Tag Browsing · Lo-fi version · Syndication · Webmaster forum history · Advertise
Developed by HumanWorks © 2005 - 2012 Webdigity webmaster community · sublime directory
Webdigity Webmaster Forums | Powered by SMF 1.0.12. © 2001-2005, Lewis Media. All Rights Reserved.