Re: [PHP] High Resolution Images
on 28/07/02 1:48 AM, [EMAIL PROTECTED] ([EMAIL PROTECTED]) wrote: > Justin, > > I did what you said, just uploaded the file and downloaded it again, and > the weirdest thing is happening. When I Form-Upload/FTP-Download it, I can > see it on my local computer, it opens everywhere. Now, when I try to see it > from the web site it is uploaded (http://ebsite/file.jpg), it does not > display. mmm Any suggestions? Is the JPEG in CMYK or RGB format as you upload? Pretty sure only RGB images work on browsers, whereas JPEGs work as CMYK as well... If you can FTP download it AND open it in Photoshop et al, then the issue is the file compatibility with the browser, probably due to CMYK, resolution, or something else. Justin French -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] High Resolution Images
Justin, I did what you said, just uploaded the file and downloaded it again, and the weirdest thing is happening. When I Form-Upload/FTP-Download it, I can see it on my local computer, it opens everywhere. Now, when I try to see it from the web site it is uploaded (http://ebsite/file.jpg), it does not display. mmm Any suggestions? - Original Message - From: "Justin French" <[EMAIL PROTECTED]> To: "Tech Support" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]> Sent: Friday, July 26, 2002 9:22 PM Subject: Re: [PHP] High Resolution Images > 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 > - 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()*100); >> $randomfile = substr(md5(rand(0,999)), 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, 'x', '') >> or die("Unable to Connect to Database"); >> mysql_select_db(); >> $sql = "INSERT INTO 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
Re: [PHP] High Resolution Images
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 ([EMAIL PROTECTED]) 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: <[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()*100); >> $randomfile = substr(md5(rand(0,999)), 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, 'x', '') >> or die("Unable to Connect to Database"); >> mysql_select_db(); >> $sql = "INSERT INTO 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
Re: [PHP] High Resolution Images
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()*100); > $randomfile = substr(md5(rand(0,999)), 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, 'x', '') >or die("Unable to Connect to Database"); > mysql_select_db(); > $sql = "INSERT INTO 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
[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()*100); $randomfile = substr(md5(rand(0,999)), 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, 'x', '') or die("Unable to Connect to Database"); mysql_select_db(); $sql = "INSERT INTO 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