File tree Expand file tree Collapse file tree 1 file changed +7
-7
lines changed Expand file tree Collapse file tree 1 file changed +7
-7
lines changed Original file line number Diff line number Diff line change @@ -81,11 +81,11 @@ public function __construct($filename)
8181
8282 case IMAGETYPE_JPEG :
8383 $ this ->source_image = $ this ->imageCreateJpegfromExif ($ filename );
84-
84+
8585 // set new width and height for image, maybe it has changed
8686 $ this ->original_w = ImageSX ($ this ->source_image );
8787 $ this ->original_h = ImageSY ($ this ->source_image );
88-
88+
8989 break ;
9090
9191 case IMAGETYPE_PNG :
@@ -99,16 +99,16 @@ public function __construct($filename)
9999
100100 return $ this ->resize ($ this ->getSourceWidth (), $ this ->getSourceHeight ());
101101 }
102-
102+
103103 // http://stackoverflow.com/a/28819866
104104 public function imageCreateJpegfromExif ($ filename ){
105105 $ img = imagecreatefromjpeg ($ filename );
106- $ exif = exif_read_data ($ filename );
107-
106+ $ exif = @ exif_read_data ($ filename );
107+
108108 if (!$ exif || !isset ($ exif ['Orientation ' ])){
109109 return $ img ;
110110 }
111-
111+
112112 $ orientation = $ exif ['Orientation ' ];
113113
114114 if ($ orientation === 6 || $ orientation === 5 ){
@@ -122,7 +122,7 @@ public function imageCreateJpegfromExif($filename){
122122 if ($ orientation === 5 || $ orientation === 4 || $ orientation === 7 ){
123123 imageflip ($ img , IMG_FLIP_HORIZONTAL );
124124 }
125-
125+
126126 return $ img ;
127127 }
128128
You can’t perform that action at this time.
0 commit comments