473,597 Members | 2,342 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

dynamic image and area creation

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.ph p?items=$itemst ring...

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

Oct 1 '07 #1
7 2364

"dino d." <di*********@ya hoo.comwrote in message
news:11******** **************@ 19g2000hsx.goog legroups.com...
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.ph p?items=$itemst ring...

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
I have read this three times and
(a) I still can't figure out what you are trying to do and
(b) what problems your are having.

Shelly
Oct 1 '07 #2
<comp.lang.ph p>
<dino d.>
<Mon, 01 Oct 2007 12:13:43 -0700>
<11************ **********@19g2 000hsx.googlegr oups.com>
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.
Easy using GD .

- grab the images and calculate the total width and/or height
- paste the images onto a newly created blank image
- create 'image map' co-ordinates and associate urls with the areas

If you have never used a 'image map' before - then create some image map
areas in a web authoring app and then have a look at the html code .
--
www.vhit.co.uk
Oct 1 '07 #3


I have read this three times and
(a) I still can't figure out what you are trying to do and
(b) what problems your are having.

Shelly
Thanks for the reply Shelly. I apologize for the confusing wording of
the problem.

Here's what the problem is in a simpler form.

If you want to create an image dynamically, and then create the
corresponding map and area tags, is there a way to somehow save the
spatial calculations that you did to create the image for use in
creating the area tags.

Let's just assume you have a page that you pass 3 strings to via GET,
and all the page does is generate three ovals containing those
strings.

That image generation page has to calculate the width of the strings,
etc. and then the size of the ovals so that the strings fit nicely
into the ovals.

Now, you want to go back and create the map to that image so when the
user clicks on the ovals, he is taken to a new page. It seems to me,
that you now have to do this spatial calculation all over again,
because there's no way to return the locations of the ovals.

Is this clearer?

Thanks again for the response.

Dino


Oct 1 '07 #4
- grab the images and calculate the total width and/or height
- paste the images onto a newly created blank image
- create 'image map' co-ordinates and associate urls with the areas
Thanks for the post. The problem is not how to do it, the problem is
how to do it efficiently? Calculating the individual image
coordinates takes n steps, and then you have to re-calculate the exact
same coordinates for the map because there is no way to get them out
of the image, short of saving them to some temp file. I am looking for
a workaround that lets me do the calculations once, render the image,
and somehow pass the calculations back to the calling script.

Dino

Oct 1 '07 #5
The 'stream' is where your going wrong .

The end result your looking for is just a normal .jpg image with a
suitable image map matched to it .

The end result .jpg and image map being generated via your genimage.php
script .
so you're suggesting saving this to a file, then referencing the file,
rather than referencing a script?

Oct 1 '07 #6
<comp.lang.ph p>
<dino d.>
<Mon, 01 Oct 2007 13:50:54 -0700>
<11************ **********@57g2 000hsv.googlegr oups.com>
The 'stream' is where your going wrong .

The end result your looking for is just a normal .jpg image with a
suitable image map matched to it .

The end result .jpg and image map being generated via your genimage.php
script .

so you're suggesting saving this to a file, then referencing the file,
rather than referencing a script?
Only if you intend to reuse the generated image , A image generated by
GD doesnt need to be saved to a file .

Either way , You need to process and create everything before using the
<imgtag to display the .jpg image .

You also need to do everything in a logical step by step fashion .

Step one in your learning curve is how to find out the (width) of the
text thats passed via GET .

Step two is generating the oval images from the above widths .

Step three is putting the text into the center of the oval .

Step four is counting up the 3 widths to create blank image .

Step five is pasting the 3 oval image onto the blank image .

No point going any further until you can do all the above .

Typing the following string into google would be aq good start .

php tutorial find the text width of a string
--
www.vhit.co.uk
Oct 1 '07 #7
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.ph p?items=$itemst ring...

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 <imgstatement .

Hope this gives you a couple of ideas.
--
=============== ===
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attgl obal.net
=============== ===
Oct 2 '07 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
2522
by: dickseacup | last post by:
Is there a way to generate a dynamic image, passing an array (of arrays) to the image creation script, such that it displays along with text on a php generated HTML page? I either get header errors (can't modify headers already sent), or I get the php script passing 'Array' to the image script instead of the actual array variable/object. How do I get dynamic, incline images to show up with surrounding text?
7
3714
by: Craig Storey | last post by:
I have a little php application to store day hiking trips and to keep a running total of their yearly trips for a few users. Currently they select their hiking routes using drop lists or checkboxes containing the names and numbers of the trails. If the route is simple the form takes 1-2 minutes to fill in, if it involves lots of tiny sections it can become tedious to search for every trailname and may take 20 minutes. Because of this...
5
4380
by: Tompa | last post by:
Hi, I would like to create images on the fly as a response to an http request. I can do this with PIL like this (file create_gif.py): from PIL import Image, ImageDraw print 'Status: 200 OK' print 'Content-type: text/html' print print '<HTML><HEAD><TITLE>Python Dynamic Image Creation Test</TITLE></HEAD>'
0
1332
by: Hemanth | last post by:
Hello, I'm generating a dynamic image on a website (using php.net/image library) and I want add hyperlinks to certain locations on the image - similar to HTML image map. Could someone pls suggest me a good way of doing this - with/without having to store the dynamic image. TIA, Hemanth
9
2940
by: pbd22 | last post by:
Hi. This is just a disaster management question. I am using XMLHTTP for the dynamic loading of content in a very crucial area of my web site. Same as an IFrame, but using XMLHTTP and a DIV. I got the core of the javascript from here: http://www.dynamicdrive.com/dynamicindex17/ajaxcontent.htm I noticed in the demo that sometimes the content takes a long
1
4646
by: MaryamSh | last post by:
Hi, I am creating a Dynamic Search in my application. I create a user control and in Page_load event I create a dynamic dropdownlist and 2 dynamic button (Add,Remove) By pressing Add button ,another row will be created with the same control (I mean another dropdown and 2 button) and so on. and by pressing Remove button the selecetd row will be removed. I used viewstate to keep my value for postback, I want by changing selectedvalue of...
0
3488
by: MaryamSh | last post by:
Create Dynamic Dropdownlist Controls and related event -------------------------------------------------------------------------------- Hi, I am creating a Dynamic Search in my application. I create a user control and in Page_load event I create a dynamic dropdownlist and 2 dynamic button (Add,Remove) By pressing Add button ,another row will be created with the same control (I mean another dropdown and 2 button) and so on. and by...
1
3385
by: neovantage | last post by:
Hey all, I am using a PHP script which creates headings at run time in a sense at page execution. I am stuck a with a very little problem which i am sure i will have the solution from experts. The problem is when it creates transparent PNG format image then and it pixel ate the image. e.g. If i am using a gradient in background then it vary in color range. Now when i used that php script it generates image successfully but it pixel ate...
0
7886
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8272
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8381
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8035
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8258
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
5847
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5431
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
3886
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
2404
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.