| @@ 194-227 (lines=34) @@ | ||
| 191 | $watermark_height = $watermarkImgInfo[1]; |
|
| 192 | ||
| 193 | $ermsg = ''; |
|
| 194 | switch ($watermarkImgInfo['mime']) { |
|
| 195 | case 'image/gif': |
|
| 196 | if (imagetypes() & IMG_GIF) { |
|
| 197 | $oWatermarkImg = imagecreatefromgif($watermark); |
|
| 198 | } else { |
|
| 199 | $ermsg = 'GIF images are not supported'; |
|
| 200 | } |
|
| 201 | break; |
|
| 202 | case 'image/jpeg': |
|
| 203 | if (imagetypes() & IMG_JPG) { |
|
| 204 | $oWatermarkImg = imagecreatefromjpeg($watermark); |
|
| 205 | } else { |
|
| 206 | $ermsg = 'JPEG images are not supported'; |
|
| 207 | } |
|
| 208 | break; |
|
| 209 | case 'image/png': |
|
| 210 | if (imagetypes() & IMG_PNG) { |
|
| 211 | $oWatermarkImg = imagecreatefrompng($watermark); |
|
| 212 | } else { |
|
| 213 | $ermsg = 'PNG images are not supported'; |
|
| 214 | } |
|
| 215 | break; |
|
| 216 | case 'image/wbmp': |
|
| 217 | if (imagetypes() & IMG_WBMP) { |
|
| 218 | $oWatermarkImg = imagecreatefromwbmp($watermark); |
|
| 219 | } else { |
|
| 220 | $ermsg = 'WBMP images are not supported'; |
|
| 221 | } |
|
| 222 | break; |
|
| 223 | default: |
|
| 224 | $oWatermarkImg = false; |
|
| 225 | $ermsg = $watermarkImgInfo['mime'].' images are not supported'; |
|
| 226 | break; |
|
| 227 | } |
|
| 228 | ||
| 229 | if (! $ermsg) { |
|
| 230 | switch ($srcImgInfo['mime']) { |
|
| @@ 230-263 (lines=34) @@ | ||
| 227 | } |
|
| 228 | ||
| 229 | if (! $ermsg) { |
|
| 230 | switch ($srcImgInfo['mime']) { |
|
| 231 | case 'image/gif': |
|
| 232 | if (imagetypes() & IMG_GIF) { |
|
| 233 | $oSrcImg = imagecreatefromgif($src); |
|
| 234 | } else { |
|
| 235 | $ermsg = 'GIF images are not supported'; |
|
| 236 | } |
|
| 237 | break; |
|
| 238 | case 'image/jpeg': |
|
| 239 | if (imagetypes() & IMG_JPG) { |
|
| 240 | $oSrcImg = imagecreatefromjpeg($src); |
|
| 241 | } else { |
|
| 242 | $ermsg = 'JPEG images are not supported'; |
|
| 243 | } |
|
| 244 | break; |
|
| 245 | case 'image/png': |
|
| 246 | if (imagetypes() & IMG_PNG) { |
|
| 247 | $oSrcImg = imagecreatefrompng($src); |
|
| 248 | } else { |
|
| 249 | $ermsg = 'PNG images are not supported'; |
|
| 250 | } |
|
| 251 | break; |
|
| 252 | case 'image/wbmp': |
|
| 253 | if (imagetypes() & IMG_WBMP) { |
|
| 254 | $oSrcImg = imagecreatefromwbmp($src); |
|
| 255 | } else { |
|
| 256 | $ermsg = 'WBMP images are not supported'; |
|
| 257 | } |
|
| 258 | break; |
|
| 259 | default: |
|
| 260 | $oSrcImg = false; |
|
| 261 | $ermsg = $srcImgInfo['mime'].' images are not supported'; |
|
| 262 | break; |
|
| 263 | } |
|
| 264 | } |
|
| 265 | ||
| 266 | if ($ermsg || false === $oSrcImg || false === $oWatermarkImg) { |
|