Re: High Resolution Images
| From: | Justin French | Date: | Sat, 27 Jul 2002 01:22:00 +0000 |
| Subject: | Re: High Resolution Images | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-109907@lists.php.net to get a copy of this message | ||
Does the maximum uploaded file size directive in php.ini refuse upload, or
cut the file off at the maximum?
If you're uploading via a browser, it *might* be chopping it off, resulting
in an invalid file.
Try *JUST* uploading the file and saving it to disk, then try downloading &
saving that file to disk... compare file sizes, and try to open the file.
If all this works, then you can rule out a file size issue, and look at
other issues, like a potential bug with large files or large resolutions.
Justin French
on 27/07/02 8:31 AM, Tech Support (jgrill@web-1hosting.net) wrote:
> 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: <oscarfm@cantv.net>
> To: <php-general@lists.php.net>
> 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
>>
>>
>>
>
>