Subversion Repositories travelsized

Rev

Blame | Last modification | View Log | RSS feed

<?PHP
        if (substr($img, -4, 4) == ".jpg" or substr($img, -4, 4) == ".JPG") {
                header("Content-type: image/jpeg");
                $src = imagecreatefromjpeg($img);
        } else if (substr($img, -4, 4) == ".png" or substr($img, -4, 4) == ".PNG") {
                header("Content-type: image/png");
                $src = imagecreatefrompng($img);
        }
        if (!$src) die("Unable to locate src image at $src");
        $out = imagecreatetruecolor($x2, $y2);
        imagecopyresampled($out, $src, 0, 0, 0, 0, $x2, $y2, $x, $y);
        imagejpeg($out);
        imagedestroy($out);
?>