View Full Version : displaying images from another vhost
rswyatt
01-16-2007, 12:41 PM
I have several sites hosted on the same server.
I'm using VHOSTS in Apache to serve the sites.
My question is this - without creating a symbolic link in one vhost to the other vhost's image folder - AND - without calling an absolute url for an image source (http://www.theotherurl.com/images/blah.jpg) -
How can I call an image to display in one site from another one? Is there a way?
firepages
01-16-2007, 01:18 PM
I don't see how you can avoid using http://etc with perhaps the exception of storing the images in a database (which has its own issues)
Many sites have a separate instance of apache (or another server) running that only serves up images but then you are back to http://
CFMaBiSmAd
01-16-2007, 02:08 PM
When a web page containing an image tag is sent from a web server to a browser, the browser makes a separate http request back to the server to fetch each image. If the URL in the HTML code for the image is a relative address, the browser takes the URL for the current web page and appends the relative URL of the image to form the full URL. The browser then requests the image. If an absolute URL for the image was used in the web page, the browser just uses it directly to fetch the image.
If the image is under a different domain than the web page currently being displayed, you must specify the full URL - http://domain_where_the_image_can_be_reached_using_a_http_request
rswyatt
01-16-2007, 02:28 PM
<sigh> I figured as much.
The problem that I have here is that we have several Intranet sites and two public sites on the same server.
What I'm attempting to do is eliminate double work by allowing one of the public sites to utilize images (the one Intranet site is almost completely project information w/ images) from the one Intranet site. The intranet site is 'protected' by Kerberos and so only Windows Authenticated (I'm on a Linux box - btw) users get straight into the Intranet site (so no need for 'log in').
I'm assuming - though I didn't try - that if I attempted to utilize the http: address in the img src for the public site that external visitors would receive an authentication prompt - even just for the image call.
Any thoughts on a workaround?
put the images in a central place (an images.host.com vhost) and access them from there for both sites.
Or,
redirect calls to host.com/images/* to point at a php script that takes the imagename as a query parameter, and serves up the right image. Not a particularly nice solution, but it should work.
vBulletin® v3.8.2, Copyright ©2000-2012, Jelsoft Enterprises Ltd.