error_reporting(0);
include("functions.php");
$h1 = "DJ Mike's Image Maker 2";
$h2 = "Quick Resize";
if ( $imageurl = trim($_GET[imageurl]) )
{
#echo "$imageurl
";
if ( @$blob = file_get_contents($imageurl))
{
#echo "$blob";
$image = new imagick();
# reject non-images
try {
$image->readImageBlob("$blob");
}
catch ( exception $e )
{
$_SESSION[error] = "$_GET[imageurl] is not an image";
header("location:$self");
}
if ( $_GET[output_type] )
{
$format = $_GET[output_type];
}
else
{
$format = $image->getimageformat();
$format = strtolower($format);
}
switch ( $format)
{
case "gif"; $format = "gif";
break;
case "jpg"; $format = "jpg";
break;
case "jpeg"; $format = "jpeg";
break;
case "png"; $format = "png";
break;
default: $format = "png";
}
$width = $image->getimagewidth();
$height = $image->getimageheight();
$w = 550/$width;
$h = 380/$height;
$best = min( $w, $h );
switch ( $_GET[fit] )
{
case width:
$width = $w*$width;
foreach ($image as $frame)
{ $frame->scaleimage( $width, 0, FALSE); }
break;
case height:
$height = $h*$height;
foreach ($image as $frame)
{ $frame->scaleimage( 0, $height, FALSE); }
break;
case best:
foreach ($image as $frame)
{ $frame->scaleimage( $best*$width, 0, FALSE); }
break;
}
$format = strtolower( $image->getimageformat() );
$path = "temp/$ID.$_SESSION[views].$format";
$image->setformat("$format");
$frames = $image->getNumberImages();
if ( $frames > 1) { $image->writeImages("$path", TRUE); }
else { $image->writeImage("$path"); }
# save settings
$_SESSION[path] = "$path";
$_SESSION[imageurl] = $imageurl;
header("Location: display.php");
header("Location: display.php?url=$path");
exit;
}
else { $_SESSION[error] = "Enter a valid URL";
header("location:$self");
exit; }
#################################
}
include("top.php");
?>
Enter a URL of a JPG, JPEG, GIF, PNG, BMP or PSD. PHP files are accepted if they are valid images.
Quickly reduce the size of very large images, even images that are too large for Imagemagick and GifWorks or too large to be viewed with a WebTV. If Fit is set to Width the width will be reduced to 550px. If set to Height will be reduced to 380px. If not set, the dimensions will be reduced for best fit. If a small image is entered, it's dimensions will be increased.
Accepts .bmp and .psd files but they will be converted. If you did not select an output file type, it will be converted to .png.
Note: If you start with animation with a width and height smaller than WebTV's screen size and it has a lot of frames it will end up with a larger file size.