You are here: Re: dynamic image and area creation « PHP Programming Language « IT news, forums, messages
Re: dynamic image and area creation

Posted by Jerry Stuckle on 10/02/07 03:16

dino d. wrote:
> Hi- I want to create a dynamic image with areas so that when the user
> clicks different areas, the user jumps to those pages. The problem
> is, I can't seem to figure out how to do this efficiently.
>
> Suppose I have a table,items in a database:
>
> itemid description count
>
> So, basically, I want to create an image that has 3 ovals,
> representing the top 3 occurring items (with the highest count) in
> this table. So, first, I create the image html:
>
> echo "<image src=genimage.php?items=$itemstring...
>
> So, here, I pass genimage a string that encodes the keys for the top 3
> occurring items. And in genimage, a query is created and called to
> get the descriptions and counts, and then displays those descriptions
> and counts in the ovals.
>
> The problem is, now I have to do this all over again to generate the
> area tags and corresponding jump URLs. Why? because I can only send
> the data in a GET string, since the image source has to be a url. So,
> I'm calling the identical query twice-once inside the image
> generation, and once in the area generation.
>
> I suppose I *could* get all the data once (the item descriptions and
> counts) and encode all of that and send that as a data string, but
> there has to be an easier way.
>
> Another suboptimal solution is to generate a temporary image and
> create img link to that image, but I'd rather keep these dynamic.
>
> So, is there a way create and then embed an image directly into a
> page? Or must I use a URL reference?
>
> In other words, what I'd like to do is something like:
>
>
> echo "<img src= THIS IMAGE STREAM I'M GENERATING RIGHT NOW...
>
> Any ideas on if this can be accomplished?
>
> Thanks,
> Dino
>

Hi, Dino,

Yes, this is a problem.

You can do it, but it's not easy.

First of all, remember that your main page (the one containing the <img>
statement) is processed first. Once it has been processed and sent to
the browser, the browser will request the file referenced in the <img>
statement.

With this information, you could do the processing in your main file,
then save the data in a file or database, then pass the information on
to the image through a query parameter.

Another option could be to store the info in the $_SESSION array, as
long as you close the session before the image is requested. Normally
this wouldn't be until after your page is completed, but for safety you
might want to close the session before you issue the <img> statement.

Hope this gives you a couple of ideas.


--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация