validation - PHP WideImage check if valid image -
i using wideimage manage images uploaded application. however, no validity checking on documents application assumes gets uploaded valid image document. how can use wideimage check if file image , not word document renamed .jpg example. have checked wideimage docs couldnt find anything.. detective skills lacking maybe thats why...
here code use wideimage:
$image = \wideimage::loadfromfile($new_file); $splash = $image->resize('600', '600', 'outside'); $splash->savetofile($dir . '/' . $media_id . '.logo.jpg');
the function loadfromfile returns image object , can validate variable $image instance of wideimage_paletteimage or wideimage_truecolorimage class.
if that's valid instance, uploaded file should valid image file.
http://wideimage.sourceforge.net/wp-content/current/doc/wideimage/wideimage.html#methodloadfromfile
Comments
Post a Comment