The HTML-Image preferences panel is where you format your image web pages.
[to be completed todo]
The HTML-Image preferences panel is where you format your image web pages.
[to be completed todo]
The HTML-Album preferences panel is where you format your album web pages.
[to be completed todo]
The HTML-Gallery preferences panel is where you format your gallery web page.
[to be completed todo]
I’ve had several people write to ask about hacking at Web Photos Pro Server Edition.
My first response was “Great! The more hackers the better.”
My second response was “How can I help you?”
There’s no rocket science in the code – it’s pretty straightforward PHP, no objects, no database, nothing over-the-top. But it represents a fair amount of work, and like all code, it looks easier to the author than it does to the hacker.
As you look at the code you should keep four things in mind:
1) It was designed to be used with the Web Photos Pro application. This means that all photos, as well as the preference file and album data files, are usually uploaded by Web Photos Pro. You’re welcome to write your own uploader, but if you do you should keep the same directory structure.
2) Reading, decrypting and parsing the preferences and album data files on every request is relatively slow, so WPP-SE (short for Web Photos Pro Server Edition) creates cache files that are read on subsequent requests. I will explain more about these cache files below.
3) I specifically decided not to use a database in this first version, partly because I felt that would simplify installation (and therefore hopefully ease adoption), but also because I was pretty confident that I could get good performance with 5,000+ photos. A future version of WPP-SE will have a database option, but you’re welcome to connect WPP-SE to a database in the meantime.
4) The only problem with hacking the code is that there is one encoded file – “includes/encrypted/encrypted.php". I encoded this one file because it contains the data file and password decryption code, and I wanted to protect it so that it couldn’t be used to decrypt passwords and data from those who use Web Photos Pro to upload static web sites. But that shouldn’t stop you from hacking away, because there are only four routines in that file that you need to know about, and I’ve documented them all below.
What’s inside of “includes/encrypted/encrypted.php"?
There are four entry points that matter inside of encrypted.php. They are:
Parameters:
none
Returns:
$galleryPrefs[]
This routine reads the encrypted file “PhotoGallery.data” from the web gallery directory, and does two things with it. First, it decrypts the file and stores the preferences in an array. Second, by calling flatten_to_cache() it caches the array to a file named “PhotoGallery.data.cache.php". It does this so that on subsequent requests it only has to reconstitute the cache file, which is significantly faster than reading the original preferences file.
You can override this routine in one of two ways: 1) you can write a replacement routine which creates the preferences array, e.g. by reading your own preferences file, or by getting the data from a database, or 2) you can create the cache file and have the existing ReadGalleryPrefs() read your cache file.
In a future blog entry I’ll explain how to do each of these.
Parameters:
$albumTitle: The album title. The album title is the same as the name of the album directory. Call ReplaceIllegalCharsInAlbumTitle($albumTitle) before using it in a file path or url.
This routine reads the encrypted file “PhotoAlbum.data” from the album directory named $albumTitle. As with ReadGalleryPrefs() above, it decrypts the file, stores the preferences in an array, caches the array to disk to a file named “PhotoAlbum.data.cache.php", and returns the array.
And as with ReadGalleryPrefs() you can either 1) write a replacement routine, or 2) write the cache file and have the existing ReadAlbumData() read your cache file.
Parameters:
$accessGroup: the name of the access group you’re looking up the password for.
$galleryPrefs: gallery preferences array created by ReadGalleryPrefs().
Returns:
$password in MD5 format.
This routine takes the name of an access group and returns the password in MD5 format. The password is then used to authorize the showing of private albums and photos therein.
(Note: your routine would not need to pass in $galleryPrefs, as you might get the password from a database, or your own data file.)
Parameters:
$galleryPrefs: gallery preferences array created by ReadGalleryPrefs().
Returns:
$password in MD5 format.
This routine takes the $galleryPrefs[] array (created by ReadGalleryPrefs()), and returns the administrator password in MD5 format.
(Note: your routine would not need to pass in $galleryPrefs, as you might get the password from a database, or your own data file.)
If you have any questions or comments, please email support@webphotospro.com, or use the online support forum.
I had an email today that asked
"Hi Frank – What’s ‘open-source’ about a $40 license?”
Which made me think about the question – is open-source the same as free?
I know there’s been a lot controversy about this, and I’ve read a lot about it in the not so distant past, but because it hadn’t affect me directly I couldn’t remember exactly who said what on the issue. So I went to Google and typed in “open-source free” and then “open-source free mark pilgrim” because I’d remembered that Mark had been quite critical of Movable Type’s 3.0 licensing changes.
After a quick look ’round the web, this is what I decided. I’m not ready for Web Photos Pro Server Edition to be “free” as defined by the Free Software Foundation. I’m not even ready for it to be “open-source” as defined by the Open Source Initiative. But I am ready to make the source “open-source” – in the lower-case sense of the word.
Why won’t I make it “free” or “OSI open-source"? Because I’ve spent the last 10 months writing Web Photos Pro and Web Photos Pro Server Edition, and my family needs to eat, and I’m pretty sure that giving the software away isn’t going to make that any more likely than not giving it away. So I’m going to maintain control of the underlying code.
But then why make it “open-source"? First because I want to make debugging possible, and integration and use easier. But more importantly, I’d like to see people writing add-ons for it. Got an idea for a better uploader than Web Photos Pro? Great, write it. Want to use a database rather than the file system the current version uses? Great, write it. And I’ll show you how. I’ve even got a piece just about finished that explains how you can write your own uploader, or attach a database.
So, in that vein, here’s how I responded to Gabe:
Gabe,
Thanks for the email. I hope I can clarify things for you a bit…
There are two products, and you may be confusing the two (which is probably the result of less-than-ideal naming as much as anything else).
Web Photos Pro is a Mac OS X and Windows XP/2000 application that makes it easy to organize, annotate and upload photos to the web – it’s $29.95(education) and $39.95(all other). It can build static photo sites, or it can connect to the second product.
The second product, Web Photos Pro Server Edition (WPP-SE), is the PHP code that I mentioned on geowanking. WPP-SE is “open-source", which means that you get the source, and can change it as much as you like for your personal use. And while you can’t redistribute the original or the modified source, you are free to distribute your own non-derivative code and explain to others how to hook it into WPP-SE. For example, you might want to write your own uploader, or attach a database, and if you do, I’m in the middle of writing something that will explain how to do that. Of course, if you like the features of WPP-SE, and want an easy way to get your photos onto the web then I hope that you’ll buy a copy of Web Photos Pro at $39.95, since that will keep me and my family in groceries, but it isn’t a requirement for using WPP-SE.
Now back to your original question “what’s open-source about a $40 license". Open-source isn’t necessarily the same as free. There are of course many free open-source projects, but one good counter-example is MovableType – it’s open source, but unless you’re using it for just a single weblog it isn’t free, and it definitely isn’t free for commercial use. So, while I’m considering making WPP-SE free for non-commercial use, I haven’t decided that yet, and I’m reserving the right not to (and it definitely won’t be free for commercial use).
I hope I’ve answered your question. And if you have any other questions, please feel free to ask.
With kindest regards,
– Frank
Powered by WordPress