I may be asking too much here but let me explain what I'm trying to do.
1.) User uploads photo
2.) Detect if the image has a solid background (most likely a logo) or if not (most likely a photograph)
3.) If it's a logo with a solid background, determine the background color
4.) if the image is not a perfect square, and a "logo" make the image a square using the script below with the determined background color.
Code: Select all
<?php
exec('convert '.ROOT.UPLOADS_IMGS.'2014/12/18/9360011418937327.jpg \
\( +clone -rotate 90 +clone -mosaic +level-colors white \) \
+swap -gravity center -composite '.ROOT.UPLOADS_IMGS.'2014/12/18/9360011418937327-bg.jpg');
?>