Image resize script – PHP

 class SimpleImage {
 function resizeImage($max_width,$max_height,$url,$destination){
  $quality = 95; $source_pic = ''.$url.'';
  $src = imagecreatefromjpeg($source_pic);
  $x_ratio = $max_width / $width; $y_ratio = $max_height / $height;
  if( ($width <= $max_width) && ($height <= $max_height) ){
   $tn_width = $width; $tn_height = $height; }
  elseif (($x_ratio * $height) < $max_height){
   $tn_height = ceil($x_ratio * $height); $tn_width = $max_width; }
  else {
   $tn_width = ceil($y_ratio * $width); $tn_height = $max_height; } $tmp=imagecreatetruecolor($tn_width,$tn_height);
  imagecopyresampled($tmp,$src,0,0,0,0,$tn_width, $tn_height,$width,$height);
  imagejpeg($tmp,$destination,$quality); imagedestroy($tmp);
 $image = (object) new resizeImage();

44 thoughts on “Image resize script – PHP”

  1. You are absolutely right. In it something is also idea excellent, I support.
    [url= ]projekty gotowe[/url]

  2. This is very interesting, You are a very skilled blogger. I’ve joined your rss feed and look forward to seeking more of your great post. Also, I’ve shared your web site in my social networks!
    [b][url=]schody granitowe [/url][/b]

  3. Quality Comments, concise points made particulaly well. Its such a rarety in the Web-Hosting sector. With this in thought your article reads like a positive conclusion of the VPS Server sector. Thank you for views!

  4. Surprisingly illuminating lots of thanks, It looks like your current visitors may possibly want way more well written articles like this carry on the fantastic content.

  5. I have been browsing on-line greater than three hours nowadays, yet I never discovered any attention-grabbing article like yours. It?s pretty price enough for me. In my opinion, if all web owners and bloggers made just right content as you probably did, the internet will likely be much more useful than ever before.

  6. Youre so cool! I dont suppose Ive read something like this before. So good to find any person with some authentic ideas on this subject. realy thank you for beginning this up. this web site is something that’s needed on the internet, somebody with slightly originality. helpful job for bringing one thing new to the web!

  7. Pretty nice post. I just stumbled upon your blog and wanted to say that I have really enjoyed browsing your blog posts. In any case I’ll be subscribing to your feed and I hope you write again soon.

  8. I’m typically to blogging and i actually admire your content. The article has actually peaks my interest. I’m going to bookmark your site and maintain checking for brand new information.

  9. I found your blog site on google and verify a number of of your early posts. Continue to maintain up the very good operate. I just further up your RSS feed to my MSN Information Reader. Searching for ahead to studying extra from you afterward!?

  10. Pingback: Atorvastatin
  11. Pingback: Hydroquinone
  12. Pingback: Hydroquinone
  13. Pingback: reseller

Leave a Reply

Your email address will not be published. Required fields are marked *