Welcome to Gaia! ::


Is it possible to take an image, dissect a section off and display just that section?
like taking this image:
User Image
and just showing the "Move Left Card"?
Well there's definitely a way, I'm sure of that. As for which feature... I'm not entirely sure. You'd have to throw in the dimensions of a card, and the width of the spacing, and define how many cards tall and wide the image is, and then use a function to copy the image from the coordinates. So the Move Left card would start at X-coord (($cardwidth * 3) + ($spacing * 3)) and Y-coord 0, and then you'd tell it to copy a rectangle from the starting X-coord and Y-coord to (X-coord1 + $cardwidth) and (Y-coord1 + $cardheight).
I could probably look into the code for you sometime tomorrow if you like. I haven't played around with GD too much yet, but I'm good at figuring out new functions pretty quickly.
If worst came to worst, you could always create a second image with the dimensions of a card, and copy them over row by row, pixel by pixel, using some for loops. But I'm certain there's gotta be a much more efficient means.
surely:
imagecopy()


imagecopy($image_dest, $image_src, $dst_x, $dst_y, $src_x, $src_y, $src_w, $src_h)


That will take the region with top left corner $src_x, $src_y, with width $src_w and height $src_h, and paste it on $image_dest with top left corner at $dst_x, $dst_y. If you want this to be the wholenew image, make the $image_dest with
imagecreate($src_w, $src_h)

and then paste at 0,0
Foolish
surely:
imagecopy()


imagecopy($image_dest, $image_src, $dst_x, $dst_y, $src_x, $src_y, $src_w, $src_h)


That will take the region with top left corner $src_x, $src_y, with width $src_w and height $src_h, and paste it on $image_dest with top left corner at $dst_x, $dst_y. If you want this to be the wholenew image, make the $image_dest with
imagecreate($src_w, $src_h)

and then paste at 0,0

Ah, but that copies a rectangular region, right? The cards have rounded corners, so as long as you don't mind showing a little bit of swirly background pattern around the corners, it'll work fine.
Colonel_Panic
Ah, but that copies a rectangular region, right? The cards have rounded corners, so as long as you don't mind showing a little bit of swirly background pattern around the corners, it'll work fine.


That really cant be avoided using this method, GD has a _very_ limited library. If he just made seperate cards and then GDed them together it would be much easier.
Foolish
Colonel_Panic
Ah, but that copies a rectangular region, right? The cards have rounded corners, so as long as you don't mind showing a little bit of swirly background pattern around the corners, it'll work fine.


That really cant be avoided using this method, GD has a _very_ limited library. If he just made seperate cards and then GDed them together it would be much easier.
Nah thats all good, thanks guys

Quick Reply

Submit
Manage Your Items
Other Stuff
Get GCash
Offers
Get Items
More Items
Where Everyone Hangs Out
Other Community Areas
Virtual Spaces
Fun Stuff
Gaia's Games
Mini-Games
Play with GCash
Play with Platinum