quocvuongdn

#php: scale image by percent ratio

Jun 6th, 2014
253
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.29 KB | None | 0 0
  1.                                                 $ratioH = $h / $objImg->getImageHeight();
  2.                         $ratioW = $w / $objImg->getImageWidth();
  3.                         $minRatio = min($ratioH, $ratioW);
  4.                        
  5.                         $newH = $objImg->getImageHeight() * $minRatio;
  6.                         $newW = $objImg->getImageWidth() * $minRatio;
Advertisement
Add Comment
Please, Sign In to add comment