Guest User

Untitled

a guest
Sep 23rd, 2018
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.33 KB | None | 0 0
  1. $master = new Imagick( $file );
  2.  
  3. $n = 5; // Number of tiles across and down
  4.  
  5. $height = $master->getimageheight() / $n;
  6. $width = $master->getimagewidth() / $n;
  7.  
  8. unset ($master );
  9.  
  10. print '<ul style="list-style: none;display: inline-block;>';
  11.  
  12. for( $imageRow = 0; $imageRow < $n; $imageRow++ ) {
  13. print '<li float: left; display: inline-block;>';
  14. for( $imageCol = 0; $imageCol < $n; $imageCol++ ) {
  15. $img = new Imagick( $file );
  16. $x = $imageCol * $width;
  17. $y = $imageRow * $height;
  18. $img->cropImage( $width, $height, $x, $y );
  19.  
  20. print '<img src="data:image/jpg;base64,' . base64_encode( $img->getImageBlob() ) . '" />';
  21. unset( $img );
  22. }
  23. print '</li>';
  24. }
  25.  
  26. print '</ul>';
Add Comment
Please, Sign In to add comment