Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $master = new Imagick( $file );
- $n = 5; // Number of tiles across and down
- $height = $master->getimageheight() / $n;
- $width = $master->getimagewidth() / $n;
- unset ($master );
- print '<ul style="list-style: none;display: inline-block;>';
- for( $imageRow = 0; $imageRow < $n; $imageRow++ ) {
- print '<li float: left; display: inline-block;>';
- for( $imageCol = 0; $imageCol < $n; $imageCol++ ) {
- $img = new Imagick( $file );
- $x = $imageCol * $width;
- $y = $imageRow * $height;
- $img->cropImage( $width, $height, $x, $y );
- print '<img src="data:image/jpg;base64,' . base64_encode( $img->getImageBlob() ) . '" />';
- unset( $img );
- }
- print '</li>';
- }
- print '</ul>';
Add Comment
Please, Sign In to add comment