Nagging (introduction to the essence of the problem)
It so happened that by the will of fate I had an iPad. Not an iPad 2, but a simple iPad without a camera and thick. Modelka turned out 16Gb, WiFi, GSM. It is quite convenient for reading mail and crawling on sites. Moreover, to view the flash you can buy Puffin for a ridiculous 99 cents. But I stop whining and turn closer to the point.
Among other things, it seemed to me that the iPad is convenient to use for viewing photos. But everything depends on the amount of internal memory. On my copy of only 16 gigabytes, which is very little for photos. You can, of course, pinch images to fit the screen size of 1024x768. But this is also not an option. First, it is necessary to do extra gestures - pinch. Secondly, photos should be uploaded to the iPad. Third, what to do if you want to print a photo? I watched, watched on the iPad screen, or showed it to relatives, or something else, and I wanted to send a photo to print (there are a lot of such services in the network). Printing 1024x768 is not an option, but finding the original photo can be difficult. Especially if you're visiting, and the photos are on your home computer. There is a way out of this situation - use photo hosting.
But not everything is so simple, I continue to whine. Be patient, a little more. For iPad, there are applications for working with photo hosting sites. You can work quite comfortably with Picassa Web, etc. services. But there again restrictions and inconveniences arise. First of all, there are no free photo hosting sites; for the normal amount of network space will have to pay well. And pay on a regular basis. Secondly, the photo hosting site will be located outside the house and it can be poured there constantly and a lot can be tiring too. Here I turn to the useful part of this article. Yes, here I firmly decided to organize photo hosting on my home server. ')
Photo hosting for iPad based on Pipho
After a short googling for any PHP galleries, etc. scripts, it became clear that we need to search for scripts specifically for the iPad. And this was immediately found - JAIPHO . This is javascript that works great with iPad and allows you to flip through photos in the usual way for iPad users. In order for it to work successfully on the server, it’s best to use it not separately, but in the PHP binding - Pipho .
Installation of this farm on the server is extremely simple and is well described in the link above. Setting up a web server is somewhat beyond the scope of this note, so I’ll omit this part. But just in case, I will briefly describe the installation of Pipho:
Download the archive pipho-1.02.00.zip from the site Pipho and unpack it on the server.
Set permissions on the directory with photos: chmod -R 777 photos
After these simple manipulations, you can go to the server browser and see a couple of test photos.
Add your photos to the hosting
Adding photos to a hosting service based on Pipho is simple:
Create a subdirectory in photos.
We copy there photos.
Create a file _gallery.txt with a description of the album. iPad understands Russian characters in UTF-8 encoding.
You can add a description to any photo, if you create a file with the name of the photo, but with the extension .txt.
After that, you need to go to the album with photos, wait and start to swear. Because Pipho creates thumbnails of photographs when it first accesses a new photo album, and this can take quite a long time. On the page of Pipho, the methods of dealing with errors that arise at this stage are described. But then I decided to optimize the process a little.
Why torment the server and wait for the thumbnails to be created? After all, you can simply copy the already prepared directory to the server. For this purpose, I wrote a small script that parasitizes the ImageMagick package and quite tolerably copes with its direct duty:
#!/bin/sh
RESIZED=resized SSIZE1=1024 SSIZE2=480 TSIZE=75
if [ ! -d ${RESIZED} ] ; then mkdir ${RESIZED} fi
for f in *.JPG *.jpg ; do fs=${RESIZED}/${f%.*}-slide-${SSIZE1}.${f##*.} if [ ! -f ${fs} -a -f ${f} ] ; then mogrify -resize ${SSIZE1} -write ${fs} ${f} fi
fs=${RESIZED}/${f%.*}-slide-${SSIZE2}.${f##*.} if [ ! -f ${fs} -a -f ${f} ] ; then mogrify -resize ${SSIZE2} -write ${fs} ${f} fi
fs=${RESIZED}/${f%.*}-thumb-${TSIZE}.${f##*.} if [ ! -f ${fs} -a -f ${f} ] ; then mogrify -resize ${TSIZE}x${TSIZE}! -write ${fs} ${f} fi done
The script is called in the catalog with photos and creates all the necessary thumbnails for the iPad and iPhone.
As a result
And the result is an excellent photo hosting service installed on the home server. At home on WiFi, viewing photos is very convenient, I did not notice the brakes. Remotely, it is also quite possible to work, and if at a guest communication is carried out over 3G, then it will not be a shame to show photos from the villa or from the exhibition. Here is an example of how it works for me (I apologize for the poor video quality):