Hello Gene,
Thank you for your answer, I haven't thought of that and it seems a
pretty decent idea. I'm using PHP heavily as a backend for my
application so there is no problem with the server side scripting on any
of the environments I'm using :)
My only concern is whether or not this will be fast enough, since I'm
gonna need quite a lot of those lines. I suppose I will also need to
include some sort of a workaround to caching mechanism but just putting
a random number in a GET request for every image should do the trick I
think.
Thank you for a great idea!
--
Best Regards,
Marcin Jakubowski
On 2009-03-22 19:42, Gene Amtower wrote:
> I attempted to create a test script to generate an image per my earlier
> post, but I had to make a minor adjustment in order to get a background
> color into the new image. Here's the modified script, noting the
> creation of an initial palette entry for the background color. It
> doesn't have to be used anywhere in the image, but it DOES have to be
> added to the palette in order for the background color to be shown in
> the image output. I think any undefined pixel is assigned the first
> color in the palette...
>
> <?php
> header ("Content-type: image/png");
> // Alert the browser that it is getting a PNG image
> $im = ImageCreate($w,$h);
> // Create an image of needed width and height; 'x' pixels are
> 0 to $w-1, 'y' pixels are 0 to $h-1
> $background_color = ImageColorAllocate($im, 255, 255, 255);
> // Define the background color as the first palette entry
> $mycolor = ImageColorAllocate($im, 0,0,0);
> // Define palette color in the new image as Black, in RGB format
> ImageLine($im, 0, 0, $w-1, $h-1, $mycolor); //
> Draw the line from 0,0 (left/top) to $w-1, $h-1 (right/bottom) in black;
> start and end positions are always x, y coordinates
> ImagePNG($im);
> // Send the new image to the output buffer
> ?>
>
> This is pretty lightweight, as it doesn't require any additional classes
> in your javascript code, but you'll need to have PHP running on your web
> server. Since the URL for the image includes the size values, you can
> update an image object in your UI by changing the image source URL,
> which should regenerate the image from the server whenever the URL is
> modified - including the size parameters. The transmitted image bytes
> are pretty low because it's palette-based with only two colors, so the
> PHP server script should provide an updated image file pretty quickly as
> well. Since it's just a PNG image, any client browser that supports PNG
> images should have no problem with it either - I think PNG support is
> pretty standard.
>
> PHP allows a variety of image types to be generated and transmitted this
> way, including GIF and JPG, so you can adjust per your actual
> requirements. You could even add parameters for the background and
> foreground colors, if desired. If you want the actual image size to be
> fixed, you could pass in different values for the image height and
> width. I think you can make this as simple or complex as you need it to be.
>
> I think you have several ways to generate the image you need - hope one
> works for you.
>
> Gene
------------------------------------------------------------------------------
Apps built with the Adobe(R) Flex(R) framework and Flex Builder(TM) are
powering Web 2.0 with engaging, cross-platform capabilities. Quickly and
easily build your RIAs with Flex Builder, the Eclipse(TM)based development
software that enables intelligent coding and step-through debugging.
Download the free 60 day trial. http://p.sf.net/sfu/www-adobe-com
_______________________________________________
qooxdoo-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel