Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
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
<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>
What I am saying is why save the image and then copy it ? You should be able to save it directly to the final folder. This will remove one step as well.
thank you again, Bonzo. What I didn't realize was that within the "exec" parameters, the image was actually being saved to the server (there doesn't seem to be a 'save' command of any kind in there). I thought that it was simply resizing it and setting the quality, then I needed to @copy it after that. I am totally unfamiliar with command line stuff.
Anyway, that worked great and I appreciate this forum and others like it. They are so valuable to programmers of all levels.