•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the PHP section within the Web Development category of DaniWeb, a massive community of 391,779 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 3,452 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our PHP advertiser: Lunarpages PHP Web Hosting
Views: 384 | Replies: 0
![]() |
Hello, thanks for helping out.
I need to upload an image, mogrify it to three smaller instances and rename it.
thanks again.
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"];
/*
****** 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);
}
}
else
echo "Invalid file";![]() |
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
•
•
•
•
•
•
•
•
DaniWeb PHP Marketplace
- Having a bit of trouble figuring out my image upload script (PHP)
- Shell Script to Zip / FTP / Delete transactional files. (Shell Scripting)
- Basic Perl Web Upload Script (Perl)
- Please help!!! Upload script.. (PHP)
- Upload/Download Script... with compression? (PHP)
Other Threads in the PHP Forum
- Previous Thread: header() not redirecting for some reason...
- Next Thread: Oracle PHP connection


Linear Mode