November 14, 2002

I was going to work on the BlogMan documentation and research B2 BloggerAPI stuff yesterday (since I know Greg would like to use BlogMan :p) but I got sidetracked by another project (aren’t you getting tired of hearing me say that? <vbg>) This one’s in Perl BTW 🙂 I was looking into CGI tagboards for Jen since she wanted one that was hosted on her own server and I found several that looked nice but came across this simple and elegant solution that I really liked because it was small and fast. However, it was missing a few features that *I* really wanted – such as the ability to convert text smilies to graphical ones and the ability to ban IP’s. Till recently, I had not even looked at installing any scripts or extras on any of my sites let alone code anything CGI based since to me that is just too much bother :p I’d go with a pre-packaged solution that somebody else offers and I’dl be happy with it – as can be seen from the tagboard on Solipsistic Meanderings :p However, the Perl code on the tagboard caught my attention and I just felt this need to change it and make it better … and that was that :p

Perl incidentally is probably the only language that I come back to after a while and have to relearn all over again 🙂 I’ve worked with Perl before (about two or three years ago the last time I think) but when I look at the regular expressions and stuff, my eyes just glaze over <vbg> So I did some reading on Perl last night and I think now I might be more up to the task 🙂 It’s going to be quite a bit of work (especially to do it the way *I* want to do it) but I think the final results would be worth it. So here comes another project for me – though I’m not sure I will distribute the scripts for this particular one once I’m done – not if I have to write a separate installation script for the stuff that I might set up by hand. But I’ll probably switch to using this script on Solipsistic Meanderings since I like it – plus, I would have coded it :p

In the meantime, there have been several questions raised about the changes to the preview feature by Edward and Nigel. To answer Nigel’s question first (about whether the temporary directory would be full of images), no the temporary directory would only contain the template images but I’m really not in favor of that idea since you currently get any images in an entry (if you created the entry just now and linked the images – but not if it is an old entry) copied over to the temporary directory for previewing. However, this would not work for anybody who has images in a location other than the same folder as the blog itself. For instance, if you have the images in a folder called Images off the blog folder, then you’ll probably link to them as Images/mypic.jpg and so would not show up since both the temporary preview blog and the images will be in the same folder. This is basically my problem with setting up some sort of template preview facility too since the images necessarily won’t be in the same location as the blog and then Blog has to do a lot of work to figure out where the images go.

Edward suggested that I copy the images over to the temporary folder once and that I delete them later – or at least I think that’s what he suggested, unfortunately, I deleted the e-mail of his comment and am offline now and so I can’t check on what he said exactly :p I guess my reluctance to do so is more philosophical than anything – I hate a program to do extra work if not necessary :p The best solution would be to have a location for template images specified on a per blog basis and then copy the files over when Blog starts to the temporary folder and then delete the contents of the temp folder when Blog shuts down. I don’t like to do all the work of copying files if nobody previews their entries at all – or they don’t do a preview during that particular run … so why do all that work? On the other hand, if you copy the images over only when they preview, then you might be duplicating the work since they might hit the preview button after every few words! Yes, I know I’m looking at extreme scenarios but the bottom line is that I don’t like to slow down the computer unless it is really necessary. I think the solution actually suggested itself when I wrote that :p I should have a flag indicating whether the image files were copied over or not and then copy them over when preview is first initiated and then set the flag so that they will not be copied over again for the current run of Blog 🙂

The world not being as simple as it could be, I just realized that this will not work either :p The problem is with the way that templates are assigned in Blog and the fact that you can publish the same blog to multiple sites with different templates! When you are writing an entry, that entry might be displayed using several different templates and each one might have the images in a different location! I guess the only way we can go about this is to give an option when you click Preview which asks you to specify the template to apply to the preview (or rather the upload site to preview since the image locations are specified by upload site) and then copy the images over and take it from there. Of course, this nullifies the whole image copy flag idea since the next time the user previews s/he might want to use a different upload site and that might have the images in a different location. Oh the complexities of giving people options :p

Posted by Fahim at 5:21 am  |  3 Comments