RE: images in posts

will <[email protected]>
Newsgroups gmane.comp.web.pyblosxom.user
Message-ID <[email protected]>
On Mon, 31 Mar 2003, Blake Winton wrote:
> 
> Just as a side note, this doesn't really work for me.  My
> weblog is at http://weblog.latte.ca/ and so /images/foo.jpg
> still gets shoved through pyblosxom.cgi, which fails to
> handle it gracefully.  So I have links to images in
> http://bwinton.latte.ca/camera/weblog/ in my weblog, which
> isn't as clean as I might like it to be.

It's better to handle this with an alias in your web-server configuration.  
If you're using Apache, stick something like this in your httpd.conf file:

Alias /images/ /path/to/images/directory/

This won't work if there's already an alias for /images/ of course.

 
> Since this is apparently an itch for me as well, I might have a go at
> adding the functionality Sean wants into the next version of PyBlosxom.  
> (It would just be a new type of EntryParser, unless I miss my guess.  
> It would have to override pretty much the whole chain of events, so that
> it just returned the image, but it might work.

It's more complex than that and actually has nothing to do with the
EntryParser.  Essentially you'll have to build a plugin that handles urls
that start like /images/ (or whatever url identifier you want) and then
pulls the image from the file system and handles the HTTP request itself 
sending the appropriate Content-type and Content-length HTTP headers.

It'll be a lot easier/faster/more-efficient/less-error-prone to handle
this in the web-server configuration rather than as a PyBlsoxom plugin.  I 
would definitely go out of your way to exhaust your options there before 
playing with a plugin like this.  It's probably not hard to write, but 
it'll crawl execution-wise compared to letting your webserver serve up the 
image files.

/will



-------------------------------------------------------
This SF.net email is sponsored by: ValueWeb: 
Dedicated Hosting for just $79/mo with 500 GB of bandwidth! 
No other company gives more support or power for your dedicated server
http://click.atdmt.com/AFF/go/sdnxxaff00300020aff/direct/01/
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.