$this->type = $info[2];
$this->mimetype = $info['mime'];
- if ($this->type == IMAGETYPE_JPEG && function_exists('exif_read_data')) {
+ if ($this->type === IMAGETYPE_JPEG && function_exists('exif_read_data')) {
// Orientation value to rotate thumbnails properly
- $exif = exif_read_data($this->filepath);
+ $exif = @exif_read_data($this->filepath);
if (is_array($exif) && isset($exif['Orientation'])) {
switch ((int)$exif['Orientation']) {
case 1: // top is top
// First some mimetype specific exceptions
switch ($file->mimetype) {
case 'image/svg+xml':
- throw new UseFileAsThumbnailException($file->id);
+ throw new UseFileAsThumbnailException($file);
}
// And we'll only consider it an image if it has such a media type
}
if (!file_exists($outpath)) {
- throw new UseFileAsThumbnailException($this->id);
+ if ($this->fileRecord instanceof File) {
+ throw new UseFileAsThumbnailException($this->fileRecord);
+ } else {
+ throw new UnsupportedMediaException('No local File object exists for ImageFile.');
+ }
}
return $outpath;
}
fclose($fh);
- return $count > 1;
+ return $count >= 1; // number of animated frames apart from the original image
}
public function getFileThumbnail($width, $height, $crop, $upscale=false)