tefflox 2 Junior Poster

Hello, thanks for helping out.

I need to upload an image, mogrify it to three smaller instances and rename it.

thanks again.

if ($_FILES["file"]["error"] > 0)

echo "Error: " . $_FILES["file"]["error"]            .     "<br />";

else {

echo "Upload: "    . $_FILES["file"]["name"]         . "<br />";
echo "Type: "      . $_FILES["file"]["type"]         . "<br />";
echo "Size: "     . ($_FILES["file"]["size"] / 1024) . " Kb<br />";
echo "Stored in: " . $_FILES["file"]["tmp_name"]     . "<br/><br/>";
}




if (((     $_FILES["file"]["type"] == "image/gif"    )
|| ( $_FILES["file"]["type"] == "image/jpeg"   )
|| ( $_FILES["file"]["type"] == "image/pjpeg"  ))
&& ( $_FILES["file"]["size"] < 1620000         )) {

if ($_FILES["file"]["error"] > 0)

echo "Return Code: " . $_FILES["file"]["error"] . "<br />";

else {

echo "Upload: " . $_FILES["file"]["name"] . "<br />";
echo "Type: " . $_FILES["file"]["type"] . "<br />";
echo "Size: " . ($_FILES["file"]["size"] / 1024) . " Kb<br />";
echo "Temp file: " . $_FILES["file"]["tmp_name"] . "<br />";
}
if (file_exists("admin_uploads/" . $_FILES["file"]["name"]))

echo $_FILES["file"]["name"] . " already exists. ";

else {

move_uploaded_file($_FILES["file"]["tmp_name"],
"admin_uploads/" . $_FILES["file"]["name"]);
echo "Stored in: " . "admin_uploads/" . $_FILES["file"]["name"];


[B]/*
******  do triple mogrify and update inventory table ******/ 


$command = '/usr/bin/mogrify';

exec("cp /admin/admin_uploads/" . $_FILES["file"]["name"] . "/admin/admin_uploads/current-large.jpg");
exec("cp /admin/admin_uploads/current-large.jpg /admin/admin_uploads/current-mid.jpg");
exec("cp /admin/admin_uploads/current-mid.jpg /admin/admin_uploads/current-tn.jpg");									

$resize_large = $command . '-resize 600x450 current-large.jpg';
$resize_mid   = $command . '-resize 300x225 current-mid.jpg';
$resize_tn    = $command . '-resize 100x100 current-tn.jpg';


// remember to validate jpg upload

exec($resize_large);
exec($resize_mid);
exec($resize_tn);
[/B]

}

}
else

echo "Invalid file";