colder          Sat Aug  5 16:06:29 2006 UTC

  Modified files:              
    /phpdoc/en/reference/image/functions        imagecopyresampled.xml 
  Log:
  Fix resize example
  
http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/image/functions/imagecopyresampled.xml?r1=1.6&r2=1.7&diff_format=u
Index: phpdoc/en/reference/image/functions/imagecopyresampled.xml
diff -u phpdoc/en/reference/image/functions/imagecopyresampled.xml:1.6 
phpdoc/en/reference/image/functions/imagecopyresampled.xml:1.7
--- phpdoc/en/reference/image/functions/imagecopyresampled.xml:1.6      Mon Oct 
 4 09:50:18 2004
+++ phpdoc/en/reference/image/functions/imagecopyresampled.xml  Sat Aug  5 
16:06:29 2006
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="iso-8859-1"?>
-<!-- $Revision: 1.6 $ -->
+<!-- $Revision: 1.7 $ -->
 <!-- splitted from ./en/functions/image.xml, last change in rev 1.36 -->
  <refentry id="function.imagecopyresampled">
   <refnamediv>
@@ -115,10 +115,12 @@
 // Get new dimensions
 list($width_orig, $height_orig) = getimagesize($filename);
 
-if ($width && ($width_orig < $height_orig)) {
-    $width = ($height / $height_orig) * $width_orig;
+$ratio_orig = $width_orig/$height_orig;
+
+if ($width/$height > $ratio_orig) {
+    $width = $height*$ratio_orig;
 } else {
-    $height = ($width / $width_orig) * $height_orig;
+    $height = $width/$ratio_orig;
 }
 
 // Resample

Reply via email to