All pastes #770382 Raw Edit

Image Script

public php v1 · immutable
·published 2007-11-12 06:35 UTC
rendered paste body
<?php$image_dir = "../"; // The directory you have your images stored in, for security reasonsif (isset($_GET["image"]) == true && eregi(".jpg", $_GET["image"]) == 1){	header("Content-type: image/jpeg;");} else {	header("Content-type: image/jpeg;");	die(@file_get_contents("404.jpg"));}if (file_exists($image_dir.$_GET["image"]) || file_exists($image_dir.str_replace(".jpg", "-".round($_GET["width"])."x".round($_GET["height"]).".jpg", $_GET["image"]))) {if (isset($_GET["height"]) && isset($_GET["width"]) && is_numeric($_GET["height"]) && is_numeric($_GET["width"])) {if (function_exists("imagecreatefromjpeg") == true && $_GET["dynamic"] == true) {	$img_src = imagecreatefromjpeg($image_dir.$_GET["image"]);	$img_src_size = getimagesize($image_dir.$_GET["image"]);	$img_dst = imagecreatetruecolor($_GET["width"], $_GET["height"]);	imagecopyresampled($img_dst, $img_src, 0, 0, 0, 0, $_GET["width"], $_GET["height"], $img_src_size[0], $img_src_size[1]);	imagejpeg($img_dst, NULL, 80);		imagedestroy($img_src);	imagedestroy($img_dst);} else {	if (file_exists($image_dir.str_replace(".jpg", "-".round($_GET["width"])."x".round($_GET["height"]).".jpg", $_GET["image"])))	{		die(file_get_contents($image_dir.str_replace(".jpg", "-".round($_GET["width"])."x".round($_GET["height"]).".jpg", $_GET["image"])));					} else {		die(file_get_contents($image_dir.$_GET["image"]));	}}} else {	die(file_get_contents($image_dir.$_GET["image"]));}} else {	die(@file_get_contents("404.jpg"));}?>