Re: High Resolution Images
| From: | Peter | Date: | Sat, 27 Jul 2002 09:58:45 +0000 |
| Subject: | Re: High Resolution Images | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-109952@lists.php.net to get a copy of this message | ||
I've had problems in some graphics viewers opening JPEGs saved in
progressive format.
Maybe saving them at such high resolution (or interlaced) isn't part of the
JPEG specifaction that GD uses.
"Oscarfm@Cantv.Net" <oscarfm@cantv.net> wrote in message
news:53670-22002752622243299@cantv.net...
> 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;
> }
> }
>
>