Jump to content

Recommended Posts

HI I have been able to get to this point but get the error message as noted below

 

I think that I'm getting closer.  I found the code within this script on the php website but I'm getting this message

Warning: Division by zero in /mnt/w0400/d11/s01/b02a5c57/www/familyclick.ca/photos/album.php on line 116

Warning: imagecreatetruecolor() [function.imagecreatetruecolor]: Invalid image dimensions in /mnt/w0400/d11/s01/b02a5c57/www/familyclick.ca/photos/album.php on line 125

Warning: imagecopyresampled(): supplied argument is not a valid Image resource in /mnt/w0400/d11/s01/b02a5c57/www/familyclick.ca/photos/album.php on line 127

any help is excellent

[code=php:0]
//Upload Images
$path = '../user_images/';
if(isset($_POST['upLoadImages'])){

foreach ($_FILES['file']['tmp_name'] as $i => $val) :
if (is_uploaded_file($_FILES['file']['tmp_name'][$i])) {

/*if ($_FILES['file']['size'][$i]>$max_file_size) { 

	$msg = "Image Exceeds maximum file size"; 

	header("location: $url?msg=$msg");
	exit;

	 }*/

if (($_FILES['file']['type'][$i]=="image/gif") || ($_FILES['file']['type'][$i]=="image/pjpeg") || ($_FILES['file']['type'][$i]=="image/jpeg") || ($_FILES['file']['type'][$i]=="image/png")) {

if (file_exists($path . $_FILES['file']['name'][$i])) { 


$msg .= "The file already exists, change your file name"; 

header("location: $url?msg=$msg");
exit; 


}// Load image

// The file
$filename = $HTTP_POST_FILES['file']['temp'][$i];

// Set a maximum height and width
$width = 200;
$height = 200;

// Content type
/*header('Content-type: image/jpeg');*/

// Get new dimensions
list($width_orig, $height_orig) = getimagesize($filename);

$ratio_orig = $width_orig/$height_orig;

if ($width/$height > $ratio_orig) {
   $width = $height*$ratio_orig;
} else {
   $height = $width/$ratio_orig;
}

// Resample
$image_p = imagecreatetruecolor($width, $height);
$image = imagecreatefromjpeg($filename);
imagecopyresampled($image_p, $image, 0, 0, 0, 0, $width, $height, $width_orig, $height_orig);

// Output
echo $image_p;
echo $image;


$res = copy($HTTP_POST_FILES['file']['tmp_name'][$i], $path.$user_name."-".$HTTP_POST_FILES['file']['name'][$i]);

if (!$res) { 

$msg .= "upload failed!"; 

header("location: $url?msg=$msg");

exit; 

} 

} else { 

header("location: $url?msg=$msg");



$msg .="Wrong file type, Must be jpeg, gif  or png file types"; exit; }


$image = $user_name."-".$HTTP_POST_FILES['file']['name'][$i];

//Set Image Size
$image_size = $_FILES['file']['size'][$i];

[/code]

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.