$h1 = "DJ Mike's Image Maker 2";
$h2 = "Named Colors";
include("functions.php");
if ( $_GET[url] )
{
$url = trim("$_GET[url]");
# reject if not start with http
if ( !preg_match( "@^http@", "$url", $match) )
{
$_SESSION[error] = "ERROR: URL's start with http";
header("location:$self");
exit;
}
# reject if can't read file
if ( !@$blob = file_get_contents("$url") )
{
$_SESSION[error] = "ERROR: Could not read $url";
header("location:$self");
exit;
}
# create image object
$image = new imagick();
# try to create image from blob
try {
$image->readImageBlob("$blob");
$format = strtolower( $image->getimageformat() );
# header("content-type:image/$format");
# echo $image;
# xxx
$path = "temp/$ID.$_SESSION[views].$format";
$_SESSION[path] = $path;
$image->writeimages("$path", TRUE );
header("location:display.php");
exit;
}
catch ( exception $e )
{
$error = $e->getmessage();
}
# if error is dedected, show it to user
if ( $error )
{
$_SESSION[error] = "ERROR: Some kind of error occured. The server says...
$error";
header("location:$self");
exit;
}
}
?>
| Color Name | Hexadecimal |
|---|