can't get rid of temp image
Posted: 2007-11-25T10:18:42-07:00
I have the following php script which works well except that a copy of the uploaded image always gets placed in the "php" directory as well as the two other specified locations (largeImages and thumbImages). How can I avoid this?
thanks
thanks
Code: Select all
<HTML>
<HEAD>
<TITLE>Successful File Upload</TITLE>
</HEAD>
<BODY>
<?
$largeImgName=$_FILES['imgLarge']['name'];
$thumbImgName=$largeImgName;
//
//
// ------------------------ IMAGE MAGICK ---------------------------
// Temporary upload image names
$originalLarge_image = $_FILES[imgLarge][tmp_name];
$originalThumb_image=$_FILES[imgLarge][tmp_name];
// set the jpg quality
$theQualityLarge=75;
$theQualityThumb=60;
// Get the image dimensions
$sizeLarge=GetImageSize( $originalLarge_image );
$sizeThumb=GetImageSize( $originalLarge_image );
// Maximum image width
$max_widthLarge = "450";
$max_widthThumb = "100";
// Maximum image height
$max_heightLarge = "450";
$max_widthThumb = "100";
//
// Resize the image and save
exec("convert -size {$sizeThumb[0]}x{$sizeThumb[1]} $originalThumb_image -thumbnail {$max_widthThumb}x{$max_heightThumb} -quality $theQualityThumb $thumbImgName");
@copy( $originalThumb_image,"/home/jmt/public_html/thumbImages/".$thumbImgName) or die("Couldn't copy the Large image.");
exec("convert -size {$sizeLarge[0]}x{$sizeLarge[1]} $originalLarge_image -thumbnail {$max_widthLarge}x{$max_heightLarge} -quality $theQualityLarge $largeImgName");
@copy($originalLarge_image,"/home/jmt/public_html/largeImages/".$largeImgName) or die("Couldn't copy the Large image.");
echo "<img src=\"".$largeImgName."\">";
?>
<H1>Success!</H1>
<P>You have uploaded the image: <b><? echo $_FILES[imgLarge][name]; ?>,</b> to your portfolio site.<br>
If you haven't already done so, be sure to create an information file about this artwork.
</BODY>
</HTML>