Using a generated image map
Hi, I've got a script which generates both an image and an image map. How to use them from a ZPT? (The problem: the image must be passed "by reference", and the map "by value") Thanks for any help, Yves
At 15:49 2003-05-26 +0200, Yves Bastide wrote:
Hi,
I've got a script which generates both an image and an image map. How to use them from a ZPT? (The problem: the image must be passed "by reference", and the map "by value")
Do it the easy way: <h3> My imagemap </h3> <img tal:replace="structure here/getMyImage" /> <p tal:replace="structure here/getMyImageMap" > Here goes the imagemap html stuff</p> Using the power of ZPT for these kinds of small things is overhead. Peter
Thanks for any help,
Yves
_______________________________________________ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )
Peter Bengtsson wrote:
At 15:49 2003-05-26 +0200, Yves Bastide wrote:
Hi,
I've got a script which generates both an image and an image map. How to use them from a ZPT? (The problem: the image must be passed "by reference", and the map "by value")
Do it the easy way:
<h3> My imagemap </h3>
<img tal:replace="structure here/getMyImage" /> <p tal:replace="structure here/getMyImageMap" > Here goes the imagemap html stuff</p>
Using the power of ZPT for these kinds of small things is overhead.
The problem is that the image and the map are generated by one quite costly script (with database accesses and such)...
Peter
Yves
At 08:52 2003-05-27 +0200, Yves Bastide wrote:
Peter Bengtsson wrote:
At 15:49 2003-05-26 +0200, Yves Bastide wrote:
Hi,
I've got a script which generates both an image and an image map. How to use them from a ZPT? (The problem: the image must be passed "by reference", and the map "by value")
Do it the easy way: <h3> My imagemap </h3> <img tal:replace="structure here/getMyImage" /> <p tal:replace="structure here/getMyImageMap" > Here goes the imagemap html stuff</p> Using the power of ZPT for these kinds of small things is overhead.
The problem is that the image and the map are generated by one quite costly script (with database accesses and such)...
The problem isn't with ZPT. I showed you how to access them, not how to store or generate them. ZPT's just stich together certain elements and generates a HTML output. So what's the problem? Peter
Peter Bengtsson wrote:
At 08:52 2003-05-27 +0200, Yves Bastide wrote:
Peter Bengtsson wrote:
At 15:49 2003-05-26 +0200, Yves Bastide wrote:
Hi,
I've got a script which generates both an image and an image map. How to use them from a ZPT? (The problem: the image must be passed "by reference", and the map "by value")
Do it the easy way: <h3> My imagemap </h3> <img tal:replace="structure here/getMyImage" /> <p tal:replace="structure here/getMyImageMap" > Here goes the imagemap html stuff</p> Using the power of ZPT for these kinds of small things is overhead.
The problem is that the image and the map are generated by one quite costly script (with database accesses and such)...
The problem isn't with ZPT. I showed you how to access them, not how to store or generate them. ZPT's just stich together certain elements and generates a HTML output.
So what's the problem?
OK, I'll try to be clearer. _The same_ script does the image and the map. If images were inlined in HTML, I'd write something like <div tal:define="img_and_map here/generateImageAndMap"> <img tal:content="img_and_map/img" usemap="#mymap"/> <map name="mymap" tal:replace="structure img_and_map/map"></map> </div>
Peter
Thanks, Yves
At 15:21 2003-05-27 +0200, Yves Bastide wrote:
Peter Bengtsson wrote:
At 08:52 2003-05-27 +0200, Yves Bastide wrote:
Peter Bengtsson wrote:
At 15:49 2003-05-26 +0200, Yves Bastide wrote:
Hi,
I've got a script which generates both an image and an image map. How to use them from a ZPT? (The problem: the image must be passed "by reference", and the map "by value")
Do it the easy way: <h3> My imagemap </h3> <img tal:replace="structure here/getMyImage" /> <p tal:replace="structure here/getMyImageMap" > Here goes the imagemap html stuff</p> Using the power of ZPT for these kinds of small things is overhead.
The problem is that the image and the map are generated by one quite costly script (with database accesses and such)...
The problem isn't with ZPT. I showed you how to access them, not how to store or generate them. ZPT's just stich together certain elements and generates a HTML output. So what's the problem?
OK, I'll try to be clearer. _The same_ script does the image and the map. If images were inlined in HTML, I'd write something like
<div tal:define="img_and_map here/generateImageAndMap"> <img tal:content="img_and_map/img" usemap="#mymap"/> <map name="mymap" tal:replace="structure img_and_map/map"></map> </div>
Looks good. But you've got the tal:content and tal:replace the wrong way around.
Yves Bastide wrote at 2003-5-27 15:21 +0200:
... OK, I'll try to be clearer. _The same_ script does the image and the map. If images were inlined in HTML, I'd write something like
<div tal:define="img_and_map here/generateImageAndMap"> <img tal:content="img_and_map/img" usemap="#mymap"/> <map name="mymap" tal:replace="structure img_and_map/map"></map> </div>
You know that HTML cannot include an image directly into a page.. It must always go via an URL. Thus, you script must make the generated image avaiblable via an URL and return the URL to the image. Dieter
Dieter Maurer wrote:
Yves Bastide wrote at 2003-5-27 15:21 +0200:
... OK, I'll try to be clearer. _The same_ script does the image and the map. If images were inlined in HTML, I'd write something like
<div tal:define="img_and_map here/generateImageAndMap"> <img tal:content="img_and_map/img" usemap="#mymap"/> <map name="mymap" tal:replace="structure img_and_map/map"></map> </div>
You know that HTML cannot include an image directly into a page.. It must always go via an URL.
Thus, you script must make the generated image avaiblable via an URL and return the URL to the image.
Yes. And that's the problem :-) I may store the image in a transient container buried in a temporary folder ... Did it once in the session, but this is gross.
Dieter
Yves
Yves Bastide wrote:
Dieter Maurer wrote:
Yves Bastide wrote at 2003-5-27 15:21 +0200:
... OK, I'll try to be clearer. _The same_ script does the image and the > map. If images were inlined in HTML, I'd write something like
<div tal:define="img_and_map here/generateImageAndMap"> <img tal:content="img_and_map/img" usemap="#mymap"/> <map name="mymap" tal:replace="structure img_and_map/map"></map> </div>
You know that HTML cannot include an image directly into a page.. It must always go via an URL.
Thus, you script must make the generated image avaiblable via an URL and return the URL to the image.
Yes. And that's the problem :-)
I may store the image in a transient container buried in a temporary folder ... Did it once in the session, but this is gross.
I'm interested. Why is this a problem (storing an image in the session)? I think the java guys store things in sessions all the time (not that this is an argument here ;)) oliver
Oliver Bleutgen wrote:
Yves Bastide wrote:
Dieter Maurer wrote:
Yves Bastide wrote at 2003-5-27 15:21 +0200:
... OK, I'll try to be clearer. _The same_ script does the image and the > map. If images were inlined in HTML, I'd write something like
<div tal:define="img_and_map here/generateImageAndMap"> <img tal:content="img_and_map/img" usemap="#mymap"/> <map name="mymap" tal:replace="structure img_and_map/map"></map> </div>
You know that HTML cannot include an image directly into a page.. It must always go via an URL.
Thus, you script must make the generated image avaiblable via an URL and return the URL to the image.
Yes. And that's the problem :-)
I may store the image in a transient container buried in a temporary folder ... Did it once in the session, but this is gross.
I'm interested. Why is this a problem (storing an image in the session)? I think the java guys store things in sessions all the time (not that this is an argument here ;))
A session is per-user, while my images aren't, so there's a small overhead for too many generations. Furthermore, I expect they'll be harder to invalidate when the things to draw change
oliver
Yves
participants (4)
-
Dieter Maurer -
Oliver Bleutgen -
Peter Bengtsson -
Yves Bastide