spacepoet Posted February 2, 2011 Share Posted February 2, 2011 I am trying to create a simple batch upload to "attach" to client's sites so they can use that in order to send me photos. I have been searching for a script and don't see one. I did find this, but it has no FORM to use: <?php set_time_limit(0); $dir = "/path/to/the/uploaded/pictures/"; // trailing slash $moveto = "/path/to/where/they/should/be/copied/"; // trailing slash $files = glob($dir . "*.jp{e,}g"); // list of files, sorted by name $i = 1; // numbering foreach ($files as $filename) { $image = imagecreatefromjpeg($filename); if (!$image) continue; // load $w = imagesx($image); $h = imagesy($image); // width, height $neww = 140; $newh = $h * $neww / $w; // resized $thumb = imagecreatetruecolor($neww, $newh); imagecopyresampled($thumb, $image, 0, 0, 0, 0, $neww, $newh, $w, $h); // create thumbnail imagejpeg($image, $moveto . $i . ".jpg"); // copy original imagejpeg($thumb, $moveto . $i . "_th.jpg"); // copy thumbnail // optional: echo "copied ", basename($filename), " (orig: $w, $h) to $i (thumb: $neww, $newh)<br>\n"; $i++; imagedestroy($image); imagedestroy($thumb); } ?> ??? Would I just need to add a TEXTAREA to it, and then people can drag-and-drop .JPGs into it and it will automatically upload the files? I am not certain. I would have thought there would be a free script for this, since it's so common. Quote Link to comment Share on other sites More sharing options...
joel24 Posted February 2, 2011 Share Posted February 2, 2011 that script is more set for allowing users to FTP upload and then allowing you to execute and copy them all across. there are plenty of upload scripts around, a quick google pulled these 3 ajax/jquery scripts (drag & drop etc) http://valums.com/ajax-upload/ http://www.uploadify.com/ http://plugins.jquery.com/project/file_uploader and here is a single PHP image upload script http://www.reconn.us/content/view/30/51/ Quote Link to comment Share on other sites More sharing options...
spacepoet Posted February 3, 2011 Author Share Posted February 3, 2011 Thanks for showing me these links. I like this one: http://plugins.jquery.com/project/file_uploader but it is missing the upload.php file. Is that a "standard" file I can find? Quote Link to comment Share on other sites More sharing options...
joel24 Posted February 3, 2011 Share Posted February 3, 2011 there is an example of how to write the back end in the documentation you'll have to look at the example they've given and modify this script to suit your needs. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.