SimpleImage.php question

I have a form where I'll be uploading images. I found a script that will resize the images. This the link to it SimpleImage.php Where on the script can I include this and how? Below is the script I'm using to upload multiple images an d text.
<?php 
session_start();
$error="";

//error_reporting(E_ALL); 


	// image upload folder
    $image_folder = 'images/classified/'; 
	// fieldnames in form
	$all_file_fields = array('image1', 'image2' ,'image3', 'image4');
	// allowed filetypes
	$file_types = array('jpg','gif','png');
	// max filesize 5mb
	$max_size = 5000000;
	//echo'<pre>';print_r($_FILES);exit;
	
	$time = time();
	$count = 1;
	
	foreach($all_file_fields as $fieldname){ 
		if($_FILES[$fieldname]['name'] != ''){
			
			$type = substr($_FILES[$fieldname]['name'], -3, 3);
						
			// check filetype
			if(in_array(strtolower($type), $file_types)){
				
				//check filesize
				if($_FILES[$fieldname]['size']>$max_size){
					$error = "File too big. Max filesize is ".$max_size." MB";
				
				}else{
				
					// new filename	
					$filename = str_replace(' ','',$myusername).'_'.$time.'_'.$count.'.'.$type;
			
					// move/upload file
					$target_path = $image_folder.basename($filename);
					move_uploaded_file($_FILES[$fieldname]['tmp_name'], $target_path);
				
					//save array with filenames
					$images[$count] = $image_folder.$filename;
					$count = $count+1;

				}//end if

			}else{ $error = "Please use jpg, gif, png files";
			
			}//end if
		}//end if
	}//end foreach



if($error != ''){ echo $error;	
}else{


/* --------------------------------------------------------------------------------------------------
SAVE TO DATABASE ------------------------------------------------------------------------------------
-------------------------------------------------------------------------------------------------- */

Open in new window

genesisvhAsked:
Who is Participating?
 
PranjalShahConnect With a Mentor Commented:
You can use the sample usage give at the end of your link or you can call the function inside your for loop, before uploading .
0
 
Vimal DMSenior Software EngineerCommented:
Hai,

Pleases find the attachment for the image re size once you uploaded the images,

These are the functions which i have used to make the image upload and resize - that is crop
functions.php
0
 
genesisvhAuthor Commented:
Thanks
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.