Posts Tagged ‘sqlite’
WordPress is an excellent platform for publishing photos on the web, but what if you don’t need all the bells and whistles it has to offer? Surprisingly, decent no-frills photo publishing applications are few and far between. After thorough research, I returned pretty much empty-handed, so I decided to hack something myself.
The result of my coding endeavors is still pretty crude, but it does the job with a minimum of fuss. At first sight, Pygmyfoto may look like a bare-bones photography blog application, but I prefer to think of it as a no-frills tool for publishing a photo roll on the web. As such, Pygmyfoto doesn’t have the features that are de rigueur of any decent blogging engine. There are no search capabilities, tagging is limited, there is no support for commenting or rating, there is no RSS feed, and all photos are presented as a single stream. In fact, Pygmyfoto is not even a pure webapp: it uses a simple SQLite database as its back end, and a couple of PHP scripts for rendering the photos and the accompanying info. Publishing photos (i.e., resizing them, adding title, description, tags, retrieving EXIF metadata etc.) is done using a relatively simple Python script. Another equally simple Python script lets you quickly archive and re-publish the photos. Data in the database that powers Pygmyfoto can be edited using an SQLite administration tool like the SQLite Manager add-on for Firefox or the phpLiteAdmin web-based tool (included with Pygmyfoto).
Pygmyfoto is not designed to replace a dedicated photography blog or gallery software. Instead, it offers a straightforward way to publish your photos as a continuous roll. Key EXIF data, such as exposure, aperture, focal length, and ISO are provided for each photo along with the link to its high resolution version.
The lack of embellishments means that, once deployed, Pygmyfoto requires practically no maintenance: you don’t have to moderate comments, manage users, remove spam, and perform other administrative chores (although you might want to back up Pygmyfoto’s files and databases regularly). The simplicity of Pygmyfoto’s overall design and its core components (Python and PHP scripts, an CSS file, and the SQLite database) mean that you can deconstruct, tweak, and improve the application even if your coding skills are not up to scratch.
A demo installation of the latest development version of Pygmyfoto is available on my server, so feel free to take a look at it. The source code is available in the project’s GitHub repository along with brief installation and usage instructions.
By default, digiKam uses two SQLite databases for storing essential data: digikam4.db and thumbnails-digikam.db. And to make the application run fast and smoothly, it’s a good idea to check and optimize the databases every now and then. To do this on Ubuntu or its derivatives, you need to install the sqlite3 package using the sudo apt-get install sqlite3 command. Once you’ve done that, back up the digikam4.db and thumbnails-digikam.db databases. Open then the terminal and switch to the directory where the databases are stored. First off, you should check the integrity of both databases using the following commands:
sqlite3 -line digikam4.db 'pragma integrity_check;'
sqlite3 -line thumbnails-digikam.db 'pragma integrity_check;'
If both databases are in order, you should see the integrity_check = ok message. To optimize the databases, run the two commands below:
sqlite3 -line digikam4.db 'vacuum;'
sqlite3 -line thumbnails-digikam.db 'vacuum;'
Run then the integrity check once again to make sure that everything works properly, and you are done.