/ Published in: PHP
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
<?php $SQUARESIZE = 108; // the size in pixels for your square images $convertPath = "/usr/local/bin/convert"; // full path to ImageMagick's convert tool $n = 0; echo $file."\n"; $originalname = $file; $filenamePart = $n++; $squarename = $filenamePart."_sq.jpg"; $squareCommand = $convertPath." \"".$path.$originalname."\" -thumbnail x".($SQUARESIZE*2)." -resize '".($SQUARESIZE*2)."x<' -resize 50% -gravity center -crop ".$SQUARESIZE."x".$SQUARESIZE."+0+0 +repage -format jpg -quality 91 \"".$path."sq/".$squarename."\""; } } } ?>
URL: http://www.randomsequence.com/articles/making-square-thumbnails-with-imagemagick/