gd library trouble - digital camera files
Posted: Wed Oct 13, 2004 10:06 am
I made a little upload area where people can store their pictures. One can choose between different thumbnail sizes etc.
The thumbnails are created using the gd lib. The list of pictures is stored in a plain textfile. It all works fine on my localhost (MacOS 10.3.5, php 4.3.7, apache 1.3x). On the server it only works partially. For some pictures from digital cameras no thumbnails are created. When trying to only open the thumbnail, I get a "Internal Server Error" message. I don't know if it has something to do with the EXIF data. The funny thing is that it works for some pictures with EXIF data. It has nothing to do with the filename, as they get processed before upload (special characters taken out etc.).
I attached the code for creating the thumbs.
$_GET['pfad'] is the path to the original file
$_GET['breite'] is the height of the thumb
Is there any way to filter the EXIF data out or to only access the raw picture data?
Thank you so much for your help
The thumbnails are created using the gd lib. The list of pictures is stored in a plain textfile. It all works fine on my localhost (MacOS 10.3.5, php 4.3.7, apache 1.3x). On the server it only works partially. For some pictures from digital cameras no thumbnails are created. When trying to only open the thumbnail, I get a "Internal Server Error" message. I don't know if it has something to do with the EXIF data. The funny thing is that it works for some pictures with EXIF data. It has nothing to do with the filename, as they get processed before upload (special characters taken out etc.).
I attached the code for creating the thumbs.
$_GET['pfad'] is the path to the original file
$_GET['breite'] is the height of the thumb
Is there any way to filter the EXIF data out or to only access the raw picture data?
Thank you so much for your help
Code: Select all
<?php
$img=imagecreatefromjpeg($_GET['pfad']);
$hoehe=imagesy($img);
$breite=imagesx($img);
$prop=$breite/$hoehe;
$neuhoehe=$_GET['breite'];
$neubreite=$prop*$neuhoehe;
if($neuhoehe>$neubreite)
{
$prop=$neubreite/$neuhoehe;
$neubreite=$prop*$neuhoehe;
}
$thumb=imagecreatetruecolor($neubreite,$neuhoehe);
imagecopyresized($thumb,$img,0,0,0,0,$neubreite,$neuhoehe,$breite,$hoehe);
Header("Content-Type: image/jpeg");
imagejpeg($thumb,"",70);
?>