View Full Version : Can Php split an image

09-05-2009, 08:39 PM
Can Php get an image file and split it into a number of segments (e.g 4x4) and then display each segments as a seperate image on screen.

09-05-2009, 09:48 PM
I haven't tried this myself, but this may be possible by cropping the image using the GD Graphic Library. See: http://www.boutell.com/gd/

09-05-2009, 09:55 PM
Yes, you could use Image Functions (http://www.php.net/manual/en/ref.image.php) for it. Basically you would need to read the file with one of the functions like imagecreatefromgif(), imagecreatefromjpeg(), imagecreatefrompng() etc. depending on the image format. imagecopyresized() would help you to copy part of the image to another image. then you would send the Content-Type header with header() and output the image with imagegif(), imagejpeg(), imagepng() etc. epending on the file format.

Edit: while I have been typing, a similar answer has been given. The forum does not have post deletion capability, so I am sorry for the duplicate post.