2 Replies - 459 Views - Last Post: 25 February 2013 - 07:40 PM Rate Topic: -----

#1 kabuto178  Icon User is offline

  • D.I.C Head

Reputation: 2
  • View blog
  • Posts: 130
  • Joined: 29-January 11

Accurate image re-sizing

Posted 25 February 2013 - 01:07 AM

I have a script that I use to scale member profile images, I was wondering what is the proper way to perform scaling for profile pictures without distorting the images native ratio too much. What is the logic behind keeping the images aspect ratio when uploading?Currently I use this bit of code to perform my scaling

//SCALING IMAGES 
    $newwidth = 301;
    $newheight = ceil(($height/$width)*$newwidth);
    $tmp = imagecreatetruecolor($newwidth,$newheight);


    imagecopyresampled($tmp,$src,0,0,0,0,$newwidth,$newheight,$width,$height);

Thank you for your time.

Is This A Good Question/Topic? 0
  • +

Replies To: Accurate image re-sizing

#2 JackOfAllTrades  Icon User is offline

  • Saucy!
  • member icon

Reputation: 6063
  • View blog
  • Posts: 23,515
  • Joined: 23-August 08

Re: Accurate image re-sizing

Posted 25 February 2013 - 04:30 AM

There are lots of perhaps useful comments at the documentation.
Was This Post Helpful? 0
  • +
  • -

#3 kabuto178  Icon User is offline

  • D.I.C Head

Reputation: 2
  • View blog
  • Posts: 130
  • Joined: 29-January 11

Re: Accurate image re-sizing

Posted 25 February 2013 - 07:40 PM

Thanks for the reply jack, I will check out the link and try to piece together my solution.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1