joshgarrod Posted December 15, 2010 Share Posted December 15, 2010 Hi, I have a script that uploads an image to a directory and then saves the fill path to a field in a table for later use. The only problem is people are uploading huge images and then when I produce a catalogue of my listings it takes forever to load because the images are so big. What I am after is an add in script to create an ADDITIONAL image 100 x 75px, I don't really want to change my upload script. Any ideas? Thanks in advace. Here is what I have: <?php $idir = "../fleet/"; // Path To Images Directory if (isset ($_FILES['fupload'])){ //upload the image to tmp directory $url = $_FILES['fupload']['name']; // Set $url To Equal The Filename For Later Use if ($_FILES['fupload']['type'] == "image/jpg" || $_FILES['fupload']['type'] == "image/jpeg" || $_FILES['fupload']['type'] == "image/pjpeg") { $file_ext = strrchr($_FILES['fupload']['name'], '$account.'); // Get The File Extention In The Format Of , For Instance, .jpg, .gif or .php $copy = copy($_FILES['fupload']['tmp_name'], "$idir" . $_FILES['fupload']['name']); // Move Image From Temporary Location To Perm } } $fleetimage1 = mysql_real_escape_string("$idir" . $_FILES['fupload']['name']); //then insert sql code below... ?> Quote Link to comment Share on other sites More sharing options...
litebearer Posted December 15, 2010 Share Posted December 15, 2010 You can use this to create thumbs using existing images (also CAN be incorporated into an upload script) http://www.nstoia.com/toh/imageresize.php Quote Link to comment Share on other sites More sharing options...
joshgarrod Posted December 15, 2010 Author Share Posted December 15, 2010 Thanks for taking the time to reply. So if I stick the main script in a seperate file, include it in my upload script and then once the image has been uploaded call the function using the code at the bottom? (Sorry I am trying to get to grips with all of this) Quote Link to comment Share on other sites More sharing options...
joshgarrod Posted December 15, 2010 Author Share Posted December 15, 2010 Never mind I managed to figure it out, thank you so much 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.