New and Improved Two-Page Comic Reader

The one-page view on most comic CMS or hosts has not been very satisfying to use. I used them because coding requires a large chunk of time and energy. At one point I did write some code for a quick demo of my Twin Stars fan comic (Figure 1 & 2). It was functional but incomplete. This week, while my macbook goes on vacation, I decided to tinker with the code again (Figure 3).

The main inspiration was due to seeing how even a tiny bit of understanding about YAML and the use of spyc.php library have made a flat-file database so easy to create, manipulate and maintain - as compared to MySQL.

Coding aside, the important thing in the planning is how to organize the data entries in the YAML file, as in how detailed you want entries to be, and how much redundancy you want to allow. Redundancy may incur more human-editing cost as well as introducing human errors, but it can reduce PHP processing time. From what I've learned, file operations generally take more (CPU) time than database operations, such as using a SQL command to search for data. MySQL (or any form of databaes) is a series of files too, but because countless number of smart programmers work to improve the package, it's bound to be more efficient than something cobbled together by a washout (:P).

So after all that mumble jumble, what have I accomplished?

Now the two-page viewer will take into account which page is the focus, by "dimming" the neighboring page (Figure 4). In the case where the left and right side pages should be viewed as a single spread, the YAML data file has a variable that lets the code know to not dim either page (for this comic, it happens 3 times).

Today I finally wrote the first version of code to generate RSS (Figure 5) based on my YAML data file (Figure 6), such that I no longer need to depend on Blogger or ComicCMS to generate RSS feeds for the comic. Freedom!

I suspect the code is inefficient and will tax the server somewhat. (Not that I feel WP/CP install makes any difference in that regard.) But it will only become a problem when there are serious traffic to the site.

Pros:
* Image files can be named whatever! Doesn't have to be tied to a date/time format. So I just drag and drop with a FTP application, instead of uploading through a web interface with a bunch of properties to fill in for each page.
* The database is one text file. Or several, depending on your need to keep multiple book data separate.
* It doesn't use complex database setup so no more database errors! (only PHP ones, but if it works during launch day it should remain workable, until the server runs out of memory. No setup can survive that)
* It doesn't use Cron to handle future posting. (For the longest time I wasn't sure how to deal with that without Cron...) The posting date is specified manually in the YAML data file, and the PHP script dynamically (yeah, that's resource-intensive) checks whether an existing file should or should not be accessible through the reader interface.

Cons:
* My code, my responsibility.
* It's not WP/CP (I don't care anymore, but maybe you do).

Note:
* Remember to disable "hotlink", and disallow direct linking to images too. There is no obfuscation on the image file name like many comic hosting sites do, so it is very easy to guess what the next page will be named, allowing eager readers to peek at pages you uploaded ahead of time.


Figures:

Figure 1.




Figure 2

Figure 3.
Figure 4. the requested page here is 2, so page 3 is dimmed; if 3 is requested, 2 will be dimmed

Figure 5.

Figure 6. First part is about chapters. The rest are info on individual pages.

No comments:

Specific RSS Feeds: Cards | Work-in-Progress | Animation