Witam,
Przy próbie wgrywania zdjęcia o rozszerzeniu .png występuje taki problem:
  1. Warning: imagecreatefromjpeg() [function.imagecreatefromjpeg]: gd-jpeg: JPEG library reports unrecoverable error: in /home/goo/public_html/adres.pl/widgets/thumbnail.inc.php on line 152
  2.  
  3. Warning: imagecreatefromjpeg() [function.imagecreatefromjpeg]: 'zdjecia/29.jpg' is not a valid JPEG file in /home/goo/public_html/adres.pl/widgets/thumbnail.inc.php on line 152
  4.  
  5. Warning: exif_read_data(29.jpg) [function.exif-read-data]: File not supported in /home/goo/public_html/adres.pl/widgets/thumbnail.inc.php on line 613
  6.  
  7. Warning: imagecopyresampled() expects parameter 2 to be resource, boolean given in /home/goo/public_html/adres.pl/widgets/thumbnail.inc.php on line 329


Jeśli wgrywam zdjęcie .jpg to problem nie występuje. Jak to naprawić?

Tutaj linie:
152:
  1. <?
  2. switch($this->format) {
  3. case 'GIF':
  4. $this->oldImage = ImageCreateFromGif($this->fileName);
  5. break;
  6. case 'JPG':
  7. $this->oldImage = ImageCreateFromJpeg($this->fileName); //linia 152
  8. break;
  9. case 'PNG':
  10. $this->oldImage = ImageCreateFromPng($this->fileName);
  11. break;
  12. }
  13. ?>


linia 329
  1. <?
  2. ImageCopyResampled(
  3. $this->workingImage,
  4. $this->oldImage,
  5. 0,
  6. 0,
  7. 0,
  8. 0,
  9. $this->newDimensions['newWidth'],
  10. $this->newDimensions['newHeight'],
  11. $this->currentDimensions['width'],
  12. $this->currentDimensions['height']
  13. );//linia 329
  14. ?>


linia 613
  1. <?
  2. if(function_exists("exif_read_data") && $this->format == 'JPG') {
  3. $imageData = exif_read_data($this->fileName);
  4. if(isset($imageData['Make']))
  5. $this->imageMeta['make'] = ucwords(strtolower($imageData['Make']));
  6. if(isset($imageData['Model']))
  7. $this->imageMeta['model'] = $imageData['Model'];
  8. if(isset($imageData['COMPUTED']['ApertureFNumber'])) {
  9. $this->imageMeta['aperture'] = $imageData['COMPUTED']['ApertureFNumber'];//linia619
  10. $this->imageMeta['aperture'] = str_replace('/','',$this->imageMeta['aperture']);
  11. }
  12. if(isset($imageData['ExposureTime'])) {
  13. $exposure = explode('/',$imageData['ExposureTime']);
  14. $exposure = round($exposure[1]/$exposure[0],-1);
  15. $this->imageMeta['exposure'] = '1/' . $exposure . ' second';
  16. }
  17. if(isset($imageData['Flash'])) {
  18. if($imageData['Flash'] > 0) {
  19. $this->imageMeta['flash'] = 'Yes';
  20. }
  21. else {
  22. $this->imageMeta['flash'] = 'No';
  23. }
  24. }
  25. if(isset($imageData['FocalLength'])) {
  26. $focus = explode('/',$imageData['FocalLength']);
  27. $this->imageMeta['focalLength'] = round($focus[0]/$focus[1],2) . ' mm';
  28. }
  29. if(isset($imageData['DateTime'])) {
  30. $date = $imageData['DateTime'];
  31. $date = explode(' ',$date);
  32. $date = str_replace(':','-',$date[0]) . ' ' . $date[1];
  33. $this->imageMeta['dateTaken'] = date('m/d/Y g:i A',strtotime($date));
  34. }
  35. }
  36. ?>


A tutaj cały kod thumbnail
http://zapisztekst.pl/116

Pozdrawiam