PHP Comic Viewer

OK, I’m gonna have to start out with a bit of geek-translation and/or explanation.

When you steal acquire comic books off of the Internet, they generally come in one of two convenient formats (or in a very inconvenient format that I don’t care about): CBR and CBZ.  CBR files are RAR files that have been renamed, and CBZ files are ZIP files that have been similarly renamed.  Both archives contain multiple individual image files, which are the pages of the acquired comic.  Traditionally, there are two potential ways to deal with these files.  You can rename them back to .rar or .zip, extract them, and use an image viewer to look at the individual pages, or you can use a specialized program that’s designed to view “comic archives”, which extracts the images to a temporary location and displays them for you.  The latter method is simply several fewer steps than the former.  The “inconvenient” format that I mentioned is “a bunch of images”.  This seems to me like a much more difficult way to manage your collection, increases the possibility that you’ll end up with 22 complete pages out of a 23-page book, and generally makes your life more complicated.  If you’re the kind of person who likes this method of comic organization, more power to you.  But I like the archive method; it fits my needs much more completely.

I was talking to my friend Paul about this a week or two ago, and he mentioned that he’d seen someone with a web-based viewer for comic archives.  Naturally, I spent a bit of time looking for it, because I’m lazy. If I can just load a web page to read comics, I’m 100 times more likely to use it than I am to download & install a comic viewer on each computer I use (please note, I actually have done this; I’m speaking of a theoretical rather than an actual).  I was unable to find such a program, in any language.  So I decided to write one myself.  It’s still in a very alpha state, but here are a couple of screenshots of the cbviewer 0.2alpha.  It uses a couple of what seem like non-stock PHP libraries (for the RAR and ZIP support), but the bonus of this is that it doesn’t use any external programs to achieve its magic; it’s 100% PHP.


I recommend clicking the thumbnails to enlarge, because the tiny squares that wordpress auto-generated really don’t do the program justice.  Naturally, I’m still working on the “make it pretty” aspect of designing a web program (aesthetics aren’t my strong suit), but at the very least I’ve managed to get everything working without having to resort to any hacks.  In this version, at least.  In version 0.1a, I was forced to use embedded base64-encoded images to display files that were inside .cbz files, because I hadn’t yet figured out how to extract the image to a temporary (and arbitrary) location without being forced to also include whatever sub-directories were included in the archive.  This had the wonderful side-effect of crashing Safari and WebKit.  0.2a eliminates that problem, as well as significantly tightening up the code, reducing the necessary number of source files from 7 down to 4 (by extending some of my previous logic and discoveries, I was able to make the archive-handling and page generation more generic).

And I think I’m done geeking out for a while, at least on this project.  I’ll probably tweak the CSS some more, in an attempt to make the site more aesthetically pleasing, but by and large I’ve got all but one of the features I want.

My Omnivore’s 100

There’s a blog called Very Good Taste, and from said blog, a food-eater’s meme has exploded onto the blogosphere (and that’s hopefully the last time I use that particular term in a non-ironic sense).  The meme is called “The Omnivore’s Hundred”, and it’s simply a list of 100 different foods that “[Andrew thinks] every good omnivore should have tried at least once in their life.”  Instructions and results are below the fold.

Continue reading My Omnivore’s 100

Blog by mail successful!

The main reason I wanted to get it set up was so I could email photos to the blog from my phone.  The default WordPress email handler, however, doesn’t play well attachments; it expects plain-text posts.  Lucky for me, there’s a plugin called Postmaster that solves the problem very nicely.  It handles pictures and videos in emails that are sent to the blog-by-mail address, and embeds ’em into new posts.  It even resizes pictures (retaining their aspect ratios) and auto-links them to the originals, and supposedly puts the videos into an embed tag that contains a quicktime player.  It looks like it might be ActiveX-based, though, so I might need to test that out and find a linux-based solution if appropriate.

Anyway, due to this new improvement, I may be posting a lot more in the future, if only because it’s a lot easier now.  Although I do dislike how long it takes to email a full-resolution photo from my BlackBerry over the EDGE network.  But I’m not about to shell out 600 bucks for a new phone with 3G, so I’ll just have to deal with it.

New Notebooks

The hardest part of starting to write in a new notebook is actually making the first mark on the first page.  I find it difficult to come up with something “good enough” or “witty enough” or “befitting the purpose of the book”.  Hopefully, I’ll change that with these stack of Cahiers.  They’re small and relatively inexpensive (more an upscale notepad than anything else), so I won’t feel too bad about using it for anything I’d like, as opposed to the hard-bound Moleskine notebooks that I carry around in my bag, which I’ve yet to fill even a third of the way out of a desire to make sure that what I write is “worth it”.

So this time, I decided “to hell with it,” grabbed a Sharpie®, and put some helpful graffiti on the first page of one of ’em.  Let’s see if this actually does the trick, and I use this one-blank book for the purpose for which it was created: to write things in.