Simple (I hope) question re: images
Hi all, I have what I suspect is a very simple question regarding images, but I've had a look through the list archives and also through the Zope book and can't track down an answer. This is a site which is being virtually hosted; Apache and Zope both running on the same box and Apache rewriting URLs to pass them to Zope. I want to keep images in a folder of their own on a Zope site that I am creating - not too unusual - and currently I'm referencing them from other folders as dtml-var "images.example_gif" (angle brackets removed to avoid confusing mail programs, browsers etc.) This gives me the right image, but the source code produced is wrong; it gives http://host.with.zope:8080/virtual.host.name/images/example.gif whereas what I'd rather have it produce would be /images/example.gif or, at a pinch, http://virtual.host.name/images/example.gif Am I missing something blatantly obvious here, or can someone suggest a workaround for this? Thanks Angie _________________________________________________________________ Join the worlds largest e-mail service with MSN Hotmail. http://www.hotmail.com
The question is simple, and the answer is rather simple also: The handling of paths when it comes to virtual hosts is far from perfect in Zope. Making things work like you want is a major accomplishment where you need to dig deep down in the internals of zope (trust me on this, I'm trying to do it :-) ). But the URL the images return works (unless your setup is very special). It's a bit ugly in the HTML code, but most people doens't read it anyway. So the really, really simple answer is: Don't worry, be happy. :-) ----- Original Message ----- From: "Angie Bayley" <angie_bayley@hotmail.com> To: <zope@zope.org> Sent: Tuesday, January 29, 2002 11:55 AM Subject: [Zope] Simple (I hope) question re: images
Hi all,
I have what I suspect is a very simple question regarding images, but I've had a look through the list archives and also through the Zope book and can't track down an answer.
This is a site which is being virtually hosted; Apache and Zope both running on the same box and Apache rewriting URLs to pass them to Zope.
I want to keep images in a folder of their own on a Zope site that I am creating - not too unusual - and currently I'm referencing them from other folders as
dtml-var "images.example_gif"
(angle brackets removed to avoid confusing mail programs, browsers etc.)
This gives me the right image, but the source code produced is wrong; it gives
http://host.with.zope:8080/virtual.host.name/images/example.gif
whereas what I'd rather have it produce would be
/images/example.gif
or, at a pinch,
http://virtual.host.name/images/example.gif
Am I missing something blatantly obvious here, or can someone suggest a workaround for this?
Angie Bayley wrote:
I want to keep images in a folder of their own on a Zope site that I am creating - not too unusual - and currently I'm referencing them from other folders as
dtml-var "images.example_gif"
Try a different approach: <img src="images/example.gif"> regards Max M
From: "Max M" <maxm@mxm.dk>
<img src="images/example.gif">
Very bad idea, since you then get a relative path to the images, emaning that images doens't get cached properly, since the webbroswer thinks /image/bla.gif is another picture than /foo/bar/image/bla.gif. But if you instead write: <img src="/images/example.gif"> it would work. However, in both these cases you don't automatically get the height, with and alt-text in the image-tag.
participants (3)
-
Angie Bayley -
Lennart Regebro -
Max M