Picsengine (flash)


I have been developing a number of sites recently that required a photo gallery included. I started using PicsEngine, a cheap Flash/ PHP /MySQL solution written by Michaël Villar. Its interface is quite intuative and there are some great features such as password protection, featured albums, image tags and displaying of EXIF data. Images can be uploaded, imported from Flickr or FTP.

It costs just €15 for a licence that covers a whole domain. You can see it in action at:

There are some small bugs in the current release (3.5.3) which I’m currently trying to get the developer to address. I’ll explain what these are later and how I’ve modified the code to resolve/work-around these issues.

The latest site I’m working on is for a camera club, where each member can have their own gallery. My current challenge is to make it psuedo multi-user. Currently I have installed an instance of the gallery for each user, prefixing the tables in the database settings during installation with a unique number. I want to get to the stage where there is only one instance of the code behind the gallery that I can pass a user_id to, still keeping the database tables prefixed and user folder the same.

I then want to adapt the user login to use the Joomla user tables.


Bug 1 – Incorrect resizing of images

During the image upload process in PicsEngine, I noticed that images were not being resized correctly.

If I uploaded a 2000×3000 pixel image and asked PicsEngine to resize to a maximum of 1500×1500 pixels, only the width size limitation seemed to be getting through.  The resulting image would therefore be 1500×2250 instead of 1000×1500.  Debugging someone else’s code isn’t easy but I eventually tracked down the error to line 350 of /admin/library/app/App.Photo.php

$maxDims = $this->getMaxDimensions();
if(($maxWidth == -1 || $maxWidth > $maxDims[0]) && $maxDims[0] != -1)
$maxWidth = $maxDims[0];
if(($maxHeight == -1 || $maxHeight > $maxDims[1]) && $maxHeight[1] != -1)
$maxHeight = $maxDims[1];

Change the last $maxHeight to $maxDims , like the line above.

$maxDims = $this->getMaxDimensions();
if(($maxWidth == -1 || $maxWidth > $maxDims[0]) && $maxDims[0] != -1)
$maxWidth = $maxDims[0];
if(($maxHeight == -1 || $maxHeight > $maxDims[1]) && $maxDims[1] != -1)
$maxHeight = $maxDims[1];


Bug 2 – Protected Images showing on iPhone

This bug is quite serious because the whole idea behind password protecting images in a gallery is that they can’t be seen at all, unless a password is provided.

The normal version of PicsEngine (flash) hides the images with a padlock image until the correct password is entered. It was brought to my attention that on an iPhone, entering a protected gallery displayed thumbnails of all the protected images. Only when you try displaying the large image does a prompt for a password get presented. PicsEngine has a detection routine for iPhones and uses a non-flash version to display the galleries.

I don’t have an iPhone, so I downloaded iBBDemo2 from , which uses Adobe AIR and takes a while to install. It emulates both an iPad and iPhone well and it’s free.

My current work around for the bug is as follows: Change to Line 99 of admin/library/view/View.iPhone.php to (removing carriage returns)

album.addPhoto({index:<!--?php echo $i; ?-->,id:<!--?php $photo--->printin('id'); ?&gt;,thumbnail:"
<!--?php if ($photo--->isProtected()){echo "";}
else {echo $photo-&gt;getIphoneThumbnailUrl();}?&gt;",protection:<!--?php $photo--->printin('protection_id'); ?&gt;});

This is not perfect as I’ve found that navigating backwards after viewing a protected image renders the thumbnails to become missing image place holders.