How I solved "unable to create thumbnail"

ibogner

Joined: 2005-04-07
Posts: 3
Posted: Thu, 2005-04-07 18:41

First - Cheers to Paour for doing great work.

My problem (followed by my solution):
I recently attempted to install Gallery 1.4 on a shared hosting account at superbhosting.net. However, I quickly discovered a problem with superbhosting and their setup. For security reasons, they have disabled the ability to execute binaries on the server. So, this means that ImageMagic and NetPBM are rendered useless. (Note: safe mode is OFF on PHP) I quickly found gallery remote and downloaded it, hoping that it would allow me to do all of the resizing and thumbnailing and just upload the finished result to gallery without doing any image processing on the server. I also quickly found out that this was not true. I was still getting "Upload Failed: Upload Error: Unable to create thumbnail (0)" from gallery remote.

My solution:
I went to the sourceforge CVS and downloaded the source to Gallery Remote to see what was up. After doing some studying of the code, I noticed that Gallery Remote doesn't upload the thumbnail, and no matter what, a thumbnail is created on the server after the image is uploaded. This wasn't going to work for me.

Basically, I modified Gallery Remote to send the thumbnail (that it had already created in order to show in the GUI) as another mime content section in the request to gallery_remote2.php. Then, I modified the gallery_remote2.php to record the thumbnail path. (I actually found that it had support to upload the thumbnail, but it just wasn't being used, so I really didn't have to change much). I fired up gallery remote, and it worked like a champ... almost.

Then I realized that the server was trying to generate a Highlight image as well. So, I hacked the albums.php file to just show the thumbnail that I had already uploaded instead of having to fire up an .exe to create the highlight image for the album.

Moral of the story:
If anyone else out there is having the same problem, I'm happy to share my modified source (without any warranty, of course). I was also hoping to generate some interest from the core developers to possibly build this into Gallery Remote natively. This feature would significantly help out other folks like myself in a shared hosting environment that doesn't allow binaries to be executed.

To view my modified gallery:
http://www.beforethethroneworship.com/gallery/

 
paour
paour's picture

Joined: 2002-08-14
Posts: 1479
Posted: Thu, 2005-04-07 18:59

Wow, congratulations! I'd gladly integrate your patch when I have a bit of time. Did you run a recent CVS build of Gallery in addition to the CVS of GR? That makes it much easier to integrate the patches.

Something else that would be great is if you could make this behavior a preference in GR, and make sure your modification to albums.php automatically senses whether it needs to create thumbnails or not.

Thanks!

 
ibogner

Joined: 2005-04-07
Posts: 3
Posted: Thu, 2005-04-07 19:15

The Gallery was not a "bleeding edge" CVS build. I grabbed the GR build that was labeled GR_RELEASE_1_4_2 (or something similar).

I'm about to do a file diff on GR before and after my mods to see everything I changed. Then I'll see about adding a checkbox to optionally upload the thumbnail to the server as well.

My mods need a bit of cleaning up before they're completely ready to be integrated, but I'll do what I can to make it easier for you. Unfortunately, I'm not a Java Swing expert, so the checkbox my take me a while longer than desired.

Would you prefer that I grabbed the latest bleeding edge of GR, rather than working with the version I've got?

I'll also do a diff on the gallery files that I had to modify and see what I can do to clean that up as well.

 
paour
paour's picture

Joined: 2002-08-14
Posts: 1479
Posted: Thu, 2005-04-07 19:23

Yeah, working with the HEAD would make it wasier to integrate. You can easily move your repository to the HEAD by clearing the sticky stuff. I hope you don't get too many conflicts...

If you send any diffs, make sure you do 'cvs diff -t'.

 
ibogner

Joined: 2005-04-07
Posts: 3
Posted: Fri, 2005-04-08 07:39

I've retrieved the latest code from HEAD and made my changes.

For Gallery Remote, changes were only necessary to:
GalleryComm2.java
AlbumInspector.java
ImageUtils.java
GRResources.properties
Album.java

For Gallery, changes were only necessary to:
gallery_remote2.php
albums.php

For Gallery Remote, I added a checkbox to the AlbumInspector panel that says "Upload Thumbnails". When checked, it will attach another multipart mime segment to the POST data which contains the image's thumbnail. Otherwise, if it is not checked, everything operates as normal.

For Gallery, gallery_remote2.php just passes along the thumbnail path (if it is not empty), otherwise, it behaves as normal. The albums.php just checks if there is a highlight image, if not, it just retrieves the thumbnail for that image instead.

My changes should not have affected any other functionality within GR or Gallery (at least, that was my intent).

I've attached the patch file for GR and Gallery (both based on latest HEAD versions from CVS).

Please do let me know if/when you integrate the changes as I'd like my software to be in sync with what the rest of the world is using. Also, please don't hesitate to ask me any questions.

AttachmentSize
gallery_patch.txt5.59 KB
gallery_remote_patch.txt12.87 KB