user1338194
user1338194

Reputation: 267

GD image Splicing

I create a large image,for a sequence of letters in one long line, (it needs to be in a long line initially), using GD library in php. I want to splice the created image into many images of a stated width and put all the images into one image showing one under another. Is this possible?

Thanks

Upvotes: 0

Views: 110

Answers (1)

Stormsson
Stormsson

Reputation: 1541

you should be able to do that by 1) creating the new empty image with

imagecreate($width,$height);  (or imagecreatetruecolor($w,$h) )

2) opening the original image (the oneliner) with

imagecreatefromjpeg($path) 

(obviously assuming it is a jpg) 3) cycling the original image "while it is not finished" and copying the pieces by using the function

imagecopy($destination_img , $source_img , $dst_x , $dst_y , $src_x , $src_y , $src_w ,  $src_h)

at each cycle you should change the dst/src coords ,to match the new "window" you choose to copy

you can find more info about how to use GD, here: http://php.net/manual/en/book.image.php

Upvotes: 1

Related Questions