Jump to content

Create thumbnail from uploaded image


joshgarrod

Recommended Posts

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...
?>

Link to comment
https://forums.phpfreaks.com/topic/221800-create-thumbnail-from-uploaded-image/
Share on other sites

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)

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.