= 1 and $x <= 400) $scale=$x; } $width=0; if( !empty($_REQUEST['width']) ) if (is_numeric($_REQUEST['width'])) { $x = $_REQUEST['width']; if($x >= 10 and $x <= 8000) $width=$x; } $height=0; if( !empty($_REQUEST['height']) ) if (is_numeric($_REQUEST['height'])) { $x = $_REQUEST['height']; if($x >= 10 and $x <= 8000) $height=$x; } if ( $errorText ) Error( $errorText ); else if( ($scale==0 || $scale==100) && $width==0 && $height==0 ) readfile( ZM_DIR_EVENTS.'/'.$path ); else { $i = imagecreatefromjpeg ( ZM_DIR_EVENTS.'/'.$path ); $oldWidth=imagesx($i); $oldHeight=imagesy($i); if($width==0 && $height==0) // scale has to be set to get here with both zero { $width = $oldWidth * $scale / 100.0; $height= $oldHeight * $scale / 100.0; } elseif ($width==0 && $height!=0) { $width = ($height * $oldWidth) / $oldHeight; } elseif ($width!=0 && $height==0) { $height = ($width * $oldHeight) / $oldWidth; } if($width==$oldWidth && $height==$oldHeight) // See if we really need to scale { imagejpg($i); imagedestroy($i); } else // we do need to scale { $iScale = imagescale($i, $width, $height); imagejpeg($iScale); imagedestroy($i); imagedestroy($iScale); } } ?>