Smarty Forum Index Smarty
The discussions here are for Smarty, a template engine for the PHP programming language.

Conflicting basedir and URL path for images in html_image

 
Post new topic   Reply to topic    Smarty Forum Index -> Plugins
View previous topic :: View next topic  
Author Message
houchin
Smarty n00b


Joined: 12 Jul 2004
Posts: 2

PostPosted: Mon Jul 12, 2004 6:59 pm    Post subject: Conflicting basedir and URL path for images in html_image Reply with quote

Currently Smarty 2.6.3 assumes that the basedir is litterally tacked onto the front of the filename in order to generate both the pathname to the actual file and the URL by which that image will be accessed. This is a major problem whenever server aliases or mod_userdir is involved. An image accessed through mod_userdir is a good example:

Actual image file: /home/user/public_html/image.jpg
Path in URL: /~user/image.jpg

In 2.6.3, there is no way to specify the path to this image, as far as I can tell. Are there any plans to add this capability?
Back to top
View user's profile Send private message
houchin
Smarty n00b


Joined: 12 Jul 2004
Posts: 2

PostPosted: Mon Jul 12, 2004 7:51 pm    Post subject: Reply with quote

Ok, I went in and solved the problem myself. I am willing to admit that there might be better solutions, but this would solve the problem, was very easy to implement, and is reasonably elegant.

Only two changes are needed:

First, define a new attribute baseurl. This attribute contains the URL correlary to the file path specified through basedir.

Second, in the line that actually constructs the image tag, change src="'.$file.'" to src="'.$baseurl.$file.'"
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Smarty Forum Index -> Plugins All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group
Protected by Anti-Spam ACP