[Owncloud] Fwd: Re: thumbnails in gallery app

Software at quantentunnel.de Software at quantentunnel.de
Tue Jan 17 21:25:41 UTC 2012


Hi Bartek

I am back online; and looked further into the php code for the gallery app.

With the code I suggested, see my mail below, rescan now works fine on my system and no longer crashes when processing unknown image formats. Cropped thumbnails for folders are created, and contain empty boxes with question marks for images in unknown formats. So far, so good. 

However, individual images in unknown formats are still not displayed as previews, not even as empty boxes with a question mark. This is because cropped thumbnails are created in two very similar functions: in apps/gallery/lib/images_utils.php for folder thumbnails; in apps/gallery/ajax/thumbnail.php for individual thumbnails. This second function also needs a similar modification (alternatively, the common parts of the two functions could be merged in a new helper function).

I kindly suggest that you insert my code or an equivalent version to fix the rescan bug and the "missing preview" bug.

Kind regards

Al_ 

-------- Original-Nachricht --------
Datum: Sat, 14 Jan 2012 22:05:47 +0100
Von: Software at quantentunnel.de
An: Bartek Przybylski <bart.p.pl at gmail.com>
CC: owncloud at kde.org
Betreff: Re: [Owncloud] thumbnails in gallery app

Hi Bartek

YES! Emptying cache worked. Now Rescan starts; but it does not complete. It stops in one subdirectory: for that folder owncloud.db contains the album entry as well as the photo entries, but no thumbnail is saved in data/username/gallery. This directory contains images that are of 'unknown' extension (*.bmp).

I suggest to replace code in apps/gallery/lib/images_utils.php, function CroppedThumbnail(...). Specfically, I suggest to replace the default handler, currently "exit();", by the following code:

        $height_orig=200;
        $width_orig=200;
        $myImage = imagecreate($width_orig, $height_orig);
        $background = imagecolorallocate($myImage, 200, 200, 200);
        $black = imagecolorallocate($myImage, 0, 0, 0);
        imagechar($myImage, 3, 0, 0, "?", $black);

This cretaes a thumbnail with a small quetsion mark for all unhandeled image formats. Redefinition of $origin_height and $origin_width is needed, as for some image formats php does not know how to extract the size (e.g., gimp pictures *.xcf are reported as size 0, 0)

Best

Al_



-- 
NEU: FreePhone - 0ct/min Handyspartarif mit Geld-zurück-Garantie!		
Jetzt informieren: http://www.gmx.net/de/go/freephone



More information about the Owncloud mailing list