This may sound silly, but you are uploading in binary mode right?

Jim Grill
Support
Web-1 Hosting
http://www.web-1hosting.net
----- Original Message -----
From: <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, July 26, 2002 5:24 PM
Subject: [PHP] High Resolution Images


> Hello,
>
> I am creating a script that takes an uploaded image, creates a thumbnail
> from it, and saves both files.
>
> The script works great, but the problem is, the files It will have to
> handle, are high-resolution files (300dpi, 24 bit-depth).. it works fine
on
> regular files (72 dpi), but when I upload a 300dpi image, it says that the
> image is not a valid JPEG file.
>
> Warning: imagecreatefromjpeg:
> '/home/sites/site1/web/uploadedHi-Res/mo_0001.jpg' is not a valid JPEG
file
> in /home/sites/site1/web/site/designers/doSubmit.php on line 6
>
> The image appears to be valid here, it opens on photoshop, and everywhere,
> however, once uploaded, the image seems to be corrupted somehow, bc if I
> download it again, it wonĘt open anywhere. Has this happened to anyone
else
> on this list?.. if so, please advise!.
>
> Here is the code for the script if it helps:
>
>
> function createThumbnail($path, $filename) {
> $src_img=ImageCreateFromJpeg($path); //HERE IT SAYS IMAGE NOT VALID
> if (imagesx($src_img)  > imagesy($src_img)) {
>  $new_w=69;
>  $new_h=40;
>  $t1 = imagesx($src_img);
>  $t2 = imagesy($src_img);
> } else {
>  $new_w=40;
>  $new_h=69;
>  $t1 = imagesy($src_img);
>  $t2 = imagesx($src_img);
>  }
> header("Content-type: image/jpeg");
> $dst_img=imagecreate($new_w,$new_h);
> imagecopyresized($dst_img,$src_img,0,0,0,0,$new_w,$new_h,$t1,$t2);
> ImageJpeg($dst_img,
> "/home/sites/site1/web/uploadedHi-Res/$filename-thumb.jpg", 50);
> }
>
>
> if (($filename_type != "image/jpeg") && ($filename_type != "image/jpg") &&
> ($filename_type != "image/pjpeg")) {
> header("Location:submitError.php"); exit;
> } else {
> srand((double)microtime()*1000000);
> $randomfile = substr(md5(rand(0,9999999)), 0, 6);
> $upload = "/home/sites/site1/web/uploadedHi-Res";
> $upload_path = "$upload/$filename_name";
> if (is_uploaded_file($filename)) {
>  Exec("cp $filename $upload_path");
>   $link = @mysql_connect(localhost, 'xxxxx', 'xxxx')
>    or die("Unable to Connect to Database");
>  mysql_select_db(xxxx);
>  $sql = "INSERT INTO xxxx VALUES ('$designer_valid', '$filename_name',
> NOW(), 'Pending')";
>  $result = mysql_query($sql) or die("Query Failed");
>  createThumbnail($upload_path, $filename_name);
>  header("Location:designSubmitted.php"); exit;
> } else {
>    header("Location:submitError.php"); exit;
>   }
> }
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
>



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to