| @@ 185-218 (lines=34) @@ | ||
| 182 | $watermark_height = $watermarkImgInfo[1]; |
|
| 183 | ||
| 184 | $ermsg = ''; |
|
| 185 | switch ($watermarkImgInfo['mime']) { |
|
| 186 | case 'image/gif': |
|
| 187 | if (@imagetypes() & IMG_GIF) { |
|
| 188 | $oWatermarkImg = @imagecreatefromgif($watermark); |
|
| 189 | } else { |
|
| 190 | $ermsg = 'GIF images are not supported'; |
|
| 191 | } |
|
| 192 | break; |
|
| 193 | case 'image/jpeg': |
|
| 194 | if (@imagetypes() & IMG_JPG) { |
|
| 195 | $oWatermarkImg = @imagecreatefromjpeg($watermark) ; |
|
| 196 | } else { |
|
| 197 | $ermsg = 'JPEG images are not supported'; |
|
| 198 | } |
|
| 199 | break; |
|
| 200 | case 'image/png': |
|
| 201 | if (@imagetypes() & IMG_PNG) { |
|
| 202 | $oWatermarkImg = @imagecreatefrompng($watermark) ; |
|
| 203 | } else { |
|
| 204 | $ermsg = 'PNG images are not supported'; |
|
| 205 | } |
|
| 206 | break; |
|
| 207 | case 'image/wbmp': |
|
| 208 | if (@imagetypes() & IMG_WBMP) { |
|
| 209 | $oWatermarkImg = @imagecreatefromwbmp($watermark); |
|
| 210 | } else { |
|
| 211 | $ermsg = 'WBMP images are not supported'; |
|
| 212 | } |
|
| 213 | break; |
|
| 214 | default: |
|
| 215 | $oWatermarkImg = false; |
|
| 216 | $ermsg = $watermarkImgInfo['mime'].' images are not supported'; |
|
| 217 | break; |
|
| 218 | } |
|
| 219 | ||
| 220 | if (! $ermsg) { |
|
| 221 | switch ($srcImgInfo['mime']) { |
|
| @@ 221-254 (lines=34) @@ | ||
| 218 | } |
|
| 219 | ||
| 220 | if (! $ermsg) { |
|
| 221 | switch ($srcImgInfo['mime']) { |
|
| 222 | case 'image/gif': |
|
| 223 | if (@imagetypes() & IMG_GIF) { |
|
| 224 | $oSrcImg = @imagecreatefromgif($src); |
|
| 225 | } else { |
|
| 226 | $ermsg = 'GIF images are not supported'; |
|
| 227 | } |
|
| 228 | break; |
|
| 229 | case 'image/jpeg': |
|
| 230 | if (@imagetypes() & IMG_JPG) { |
|
| 231 | $oSrcImg = @imagecreatefromjpeg($src) ; |
|
| 232 | } else { |
|
| 233 | $ermsg = 'JPEG images are not supported'; |
|
| 234 | } |
|
| 235 | break; |
|
| 236 | case 'image/png': |
|
| 237 | if (@imagetypes() & IMG_PNG) { |
|
| 238 | $oSrcImg = @imagecreatefrompng($src) ; |
|
| 239 | } else { |
|
| 240 | $ermsg = 'PNG images are not supported'; |
|
| 241 | } |
|
| 242 | break; |
|
| 243 | case 'image/wbmp': |
|
| 244 | if (@imagetypes() & IMG_WBMP) { |
|
| 245 | $oSrcImg = @imagecreatefromwbmp($src); |
|
| 246 | } else { |
|
| 247 | $ermsg = 'WBMP images are not supported'; |
|
| 248 | } |
|
| 249 | break; |
|
| 250 | default: |
|
| 251 | $oSrcImg = false; |
|
| 252 | $ermsg = $srcImgInfo['mime'].' images are not supported'; |
|
| 253 | break; |
|
| 254 | } |
|
| 255 | } |
|
| 256 | ||
| 257 | if ($ermsg || false === $oSrcImg || false === $oWatermarkImg) { |
|
| @@ 114-147 (lines=34) @@ | ||
| 111 | } |
|
| 112 | ||
| 113 | private function resize_gd($src, $width, $height, $quality, $srcImgInfo) { |
|
| 114 | switch ($srcImgInfo['mime']) { |
|
| 115 | case 'image/gif': |
|
| 116 | if (@imagetypes() & IMG_GIF) { |
|
| 117 | $oSrcImg = @imagecreatefromgif($src); |
|
| 118 | } else { |
|
| 119 | $ermsg = 'GIF images are not supported'; |
|
| 120 | } |
|
| 121 | break; |
|
| 122 | case 'image/jpeg': |
|
| 123 | if (@imagetypes() & IMG_JPG) { |
|
| 124 | $oSrcImg = @imagecreatefromjpeg($src) ; |
|
| 125 | } else { |
|
| 126 | $ermsg = 'JPEG images are not supported'; |
|
| 127 | } |
|
| 128 | break; |
|
| 129 | case 'image/png': |
|
| 130 | if (@imagetypes() & IMG_PNG) { |
|
| 131 | $oSrcImg = @imagecreatefrompng($src) ; |
|
| 132 | } else { |
|
| 133 | $ermsg = 'PNG images are not supported'; |
|
| 134 | } |
|
| 135 | break; |
|
| 136 | case 'image/wbmp': |
|
| 137 | if (@imagetypes() & IMG_WBMP) { |
|
| 138 | $oSrcImg = @imagecreatefromwbmp($src); |
|
| 139 | } else { |
|
| 140 | $ermsg = 'WBMP images are not supported'; |
|
| 141 | } |
|
| 142 | break; |
|
| 143 | default: |
|
| 144 | $oSrcImg = false; |
|
| 145 | $ermsg = $srcImgInfo['mime'].' images are not supported'; |
|
| 146 | break; |
|
| 147 | } |
|
| 148 | ||
| 149 | if ($oSrcImg && false != ($tmp = imagecreatetruecolor($width, $height))) { |
|
| 150 | ||