Re: GD imagerectangle() function - background transparency?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Effectively, I've got sort of template images, and want to sort of draw multiple outline boxes onto them where users can then choose one to then insert text onto image - almost like a form of eCard template rendition, but, bit different.

I was originally trying to show the boxes/areas to the user using relatively positioned template images, overlaid by absolutely positioned div elements, with coloured borders, handled using CSS, and then jQuery to manipulate the highlighted/chosen one by changing it's border-color CSS attribute, client-side/at runtime, but, this doesn't always seem to cooperate/implement it at run time.

Have now told them will try sort of dynamically generating a version of the template image, server-side, with the various area outlines drawn onto it, which can then reload at run-time when a new text outline area is selected, but initially tried creating an image resource from the template file, and then using imagerectangle to draw a rectangle onto it, after allocating the relevant colour, and setting drawing thickness, but, it seemed to be blanking out the template image, so I then tried creating a new image resource of the same dimensions, filling it up with an obscure colour, draw the rectangle onto it, set it's transparency to the obscure colour, and then use either imagecopy() or imagecopymerge() to copy it over the original template image, but, still seems to be just blocking out the actual template image.

Now, suppose will maybe also try out splitting the blocks to be drawn up into actual lines, and just try drawing the lines onto the original template image, and see if that works, since at the moment, apparently the combination output image is just a white background, with the coloured boxes on it - as in, it's again just blocked out the original image, as opposed to actually overlaying a somewhat transparent image onto it, and suppose this could be due to pallett's not matching, or something..?

Anyway, let me quickly slap together a couple of tests, and will try post a link, and source code, etc.

Thanks

Jacob Kruger
Blind Biker
Skype: BlindZA
'...fate had broken his body, but not his spirit...'

----- Original Message ----- From: "Pierre Joye" <pierre.php@xxxxxxxxx>
To: "Jacob Kruger" <jacob@xxxxxxxxxxxxx>
Cc: "php-windows" <php-windows@xxxxxxxxxxxxx>
Sent: Friday, September 06, 2013 7:59 AM
Subject: Re: GD imagerectangle() function - background transparency?


hi!

On Thu, Sep 5, 2013 at 10:35 PM, Jacob Kruger <jacob@xxxxxxxxxxxxx> wrote:
Just wondering, if I load an existing image into an image resource, and then draw a rectangle on it using the GD imagerectangle() function, and specifically not using the imagefilledrectangle() function, does the new rectangle/box overlay the existing image content, or just draw the outlines thereof onto/overlaying the existing content?

Alternatively, should I load the existing image, then use something like imagecreatetruecolor() to create another image resource of the same dimensions, fill it with an obscure colour, draw the rectangle on it, set the transparency colour for that specific image resource to the obscure colour, and then copy it over the original/existing image resource before outputting/returning the combination?

imagecopy supports alpha, imageoverlay lets you define the mode. But
I'm not sure what kind of results you try to achieve, please put a
link to an example result image with the two source images, it could
help :)

--
Pierre

@pierrejoye | http://www.libgd.org


--
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php





[Index of Archives]     [PHP Home]     [PHP Users]     [PHP Database Programming]     [PHP Install]     [Kernel Newbies]     [Yosemite Forum]     [PHP Books]

  Powered by Linux