[Owncloud] thumbnails in gallery app

Software at quantentunnel.de Software at quantentunnel.de
Sat Jan 14 21:05:47 UTC 2012


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_

PS: I will be mostly offline for the neyt few days.


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

> Hi!
> Your db scheme is correct, so no err here ;)
> but scanForAlbum.php was removed, and most gallery related operations
> were moved to galleryOp.php
> and it is like this on master ;)
> looks like your browser holds old javascript's because newone are updated,
> please clear you cache and let me know how it went :)
> 
> bartek
> 
> 2012/1/14  <Software at quantentunnel.de>:
> > Hi Bartek
> >
> > As it works on your end, I digged a bit into the issue. It appears
> (according to apache2/error.log) that
> /var/www/owncloud/apps/gallery/ajax/scanForAlbums.php is called, but this file does not exist. (why? I am on git
> master branch with a clean working directory).
> >
> > Nevertheless, to answer your direct questions and although the above
> issue is most likely the cause:
> >
> > The sqlite3 .schema of owncloud.db:
> > CREATE TABLE "oc_appconfig" ("appid" VARCHAR(255) DEFAULT ' ' NOT NULL,
> "configkey" VARCHAR(255) DEFAULT ' ' NOT NULL, "configvalue" VARCHAR(255)
> DEFAULT ' ' NOT NULL);
> > CREATE TABLE "oc_authtoken" ("token" VARCHAR(40) DEFAULT ' ' NOT NULL,
> "appUrl" VARCHAR(128) DEFAULT ' ' NOT NULL, "user" VARCHAR(64) DEFAULT ' '
> NOT NULL, "category" VARCHAR(64) DEFAULT ' ' NOT NULL);
> > CREATE TABLE "oc_bookmarks" ("id" INTEGER PRIMARY KEY AUTOINCREMENT,
> "url" VARCHAR(4096) DEFAULT ' ' NOT NULL, "title" VARCHAR(140) DEFAULT ' ' NOT
> NULL, "user_id" VARCHAR(64) DEFAULT ' ' NOT NULL, "public" SMALLINT
> DEFAULT 0, "added" INTEGER UNSIGNED DEFAULT NULL, "lastmodified" INTEGER UNSIGNED
> DEFAULT NULL, "clickcount" INTEGER UNSIGNED DEFAULT 0 NOT NULL);
> > CREATE TABLE "oc_bookmarks_tags" ("bookmark_id" BIGINT DEFAULT 0, "tag"
> VARCHAR(255) DEFAULT ' ' NOT NULL);
> > CREATE TABLE "oc_calendar_calendars" ("id" INTEGER PRIMARY KEY
> AUTOINCREMENT, "userid" VARCHAR(255), "displayname" VARCHAR(100), "uri"
> VARCHAR(100), "active" INTEGER DEFAULT 1 NOT NULL, "ctag" INTEGER UNSIGNED DEFAULT 0
> NOT NULL, "calendarorder" INTEGER UNSIGNED DEFAULT 0 NOT NULL,
> "calendarcolor" VARCHAR(10), "timezone" LONGTEXT, "components" VARCHAR(100));
> > CREATE TABLE "oc_calendar_objects" ("id" INTEGER PRIMARY KEY
> AUTOINCREMENT, "calendarid" INTEGER UNSIGNED DEFAULT 0 NOT NULL, "objecttype"
> VARCHAR(40) DEFAULT ' ' NOT NULL, "startdate" DATETIME DEFAULT '0000-00-00
> 00:00:00', "enddate" DATETIME DEFAULT '0000-00-00 00:00:00', "repeating" INTEGER
> DEFAULT NULL, "summary" VARCHAR(255), "calendardata" LONGTEXT, "uri"
> VARCHAR(100), "lastmodified" INTEGER DEFAULT NULL);
> > CREATE TABLE "oc_contacts_addressbooks" ("id" INTEGER PRIMARY KEY
> AUTOINCREMENT, "userid" VARCHAR(255) DEFAULT ' ' NOT NULL, "displayname"
> VARCHAR(255), "uri" VARCHAR(100), "description" LONGTEXT, "ctag" INTEGER UNSIGNED
> DEFAULT 1 NOT NULL);
> > CREATE TABLE "oc_contacts_cards" ("id" INTEGER PRIMARY KEY
> AUTOINCREMENT, "addressbookid" INTEGER UNSIGNED DEFAULT 0 NOT NULL, "fullname"
> VARCHAR(255), "carddata" LONGTEXT, "uri" VARCHAR(100), "lastmodified" INTEGER
> UNSIGNED DEFAULT NULL);
> > CREATE TABLE "oc_foldersize" ("path" VARCHAR(512) DEFAULT ' ' NOT NULL,
> "size" INTEGER DEFAULT 0 NOT NULL);
> > CREATE TABLE "oc_gallery_albums" ("album_id" INTEGER PRIMARY KEY
> AUTOINCREMENT, "uid_owner" VARCHAR(64) DEFAULT ' ' NOT NULL, "album_name"
> VARCHAR(100) DEFAULT ' ' NOT NULL, "album_path" VARCHAR(100) DEFAULT ' ' NOT NULL);
> > CREATE TABLE "oc_gallery_photos" ("photo_id" INTEGER PRIMARY KEY
> AUTOINCREMENT, "album_id" INTEGER DEFAULT 0 NOT NULL, "file_path" VARCHAR(100)
> DEFAULT ' ' NOT NULL);
> > CREATE TABLE "oc_group_user" ("gid" VARCHAR(64) DEFAULT ' ' NOT NULL,
> "uid" VARCHAR(64) DEFAULT ' ' NOT NULL);
> > CREATE TABLE "oc_groups" ("gid" VARCHAR(64) DEFAULT ' ' NOT NULL,
> PRIMARY KEY (gid));
> > CREATE TABLE "oc_locks" ("id" INTEGER PRIMARY KEY AUTOINCREMENT,
> "userid" VARCHAR(200), "owner" VARCHAR(100), "timeout" INTEGER UNSIGNED DEFAULT
> NULL, "created" INTEGER DEFAULT NULL, "token" VARCHAR(100), "scope" SMALLINT
> DEFAULT NULL, "depth" SMALLINT DEFAULT NULL, "uri" LONGTEXT);
> > CREATE TABLE "oc_log" ("id" INTEGER PRIMARY KEY AUTOINCREMENT, "moment"
> DATETIME DEFAULT '0000-00-00 00:00:00' NOT NULL, "appid" VARCHAR(255)
> DEFAULT ' ' NOT NULL, "user" VARCHAR(255) DEFAULT ' ' NOT NULL, "action"
> VARCHAR(255) DEFAULT ' ' NOT NULL, "info" LONGTEXT NOT NULL);
> > CREATE TABLE "oc_media_albums" ("album_id" INTEGER PRIMARY KEY
> AUTOINCREMENT, "album_name" VARCHAR(200) DEFAULT ' ' NOT NULL, "album_artist"
> INTEGER DEFAULT 0 NOT NULL, "album_art" VARCHAR(200) DEFAULT ' ' NOT NULL);
> > CREATE TABLE "oc_media_artists" ("artist_id" INTEGER PRIMARY KEY
> AUTOINCREMENT, "artist_name" VARCHAR(200) DEFAULT ' ' NOT NULL);
> > CREATE TABLE "oc_media_sessions" ("session_id" INTEGER PRIMARY KEY
> AUTOINCREMENT, "token" VARCHAR(64) DEFAULT ' ' NOT NULL, "user_id" VARCHAR(64)
> DEFAULT ' ' NOT NULL, "start" DATETIME DEFAULT '1970-01-01 00:00:00' NOT
> NULL);
> > CREATE TABLE "oc_media_songs" ("song_id" INTEGER PRIMARY KEY
> AUTOINCREMENT, "song_name" VARCHAR(200) DEFAULT ' ' NOT NULL, "song_artist" INTEGER
> DEFAULT 0 NOT NULL, "song_album" INTEGER DEFAULT 0 NOT NULL, "song_path"
> VARCHAR(200) DEFAULT ' ' NOT NULL, "song_user" VARCHAR(64) DEFAULT '0' NOT
> NULL, "song_length" INTEGER DEFAULT 0 NOT NULL, "song_track" INTEGER DEFAULT 0
> NOT NULL, "song_size" INTEGER DEFAULT 0 NOT NULL, "song_playcount" INTEGER
> DEFAULT 0 NOT NULL, "song_lastplayed" INTEGER DEFAULT 0 NOT NULL);
> > CREATE TABLE "oc_media_users" ("user_id" VARCHAR(64) DEFAULT '0' NOT
> NULL, "user_password_sha256" VARCHAR(64) DEFAULT ' ' NOT NULL);
> > CREATE TABLE "oc_preferences" ("userid" VARCHAR(255) DEFAULT ' ' NOT
> NULL, "appid" VARCHAR(255) DEFAULT ' ' NOT NULL, "configkey" VARCHAR(255)
> DEFAULT ' ' NOT NULL, "configvalue" VARCHAR(255) DEFAULT ' ' NOT NULL);
> > CREATE TABLE "oc_principalgroups" ("id" INTEGER PRIMARY KEY
> AUTOINCREMENT, "principal_id" INTEGER UNSIGNED DEFAULT 0 NOT NULL, "member_id" INTEGER
> UNSIGNED DEFAULT 0 NOT NULL);
> > CREATE TABLE "oc_principals" ("id" INTEGER PRIMARY KEY AUTOINCREMENT,
> "uri" VARCHAR(255), "displayname" VARCHAR(255));
> > CREATE TABLE "oc_properties" ("userid" VARCHAR(200) DEFAULT ' ' NOT
> NULL, "propertypath" VARCHAR(255) DEFAULT ' ' NOT NULL, "propertyname"
> VARCHAR(255) DEFAULT ' ' NOT NULL, "propertyvalue" LONGTEXT NOT NULL);
> > CREATE TABLE "oc_sharing" ("uid_owner" VARCHAR(64) DEFAULT ' ' NOT NULL,
> "uid_shared_with" VARCHAR(64) DEFAULT ' ' NOT NULL, "source" VARCHAR(128)
> DEFAULT ' ' NOT NULL, "target" VARCHAR(128) DEFAULT ' ' NOT NULL,
> "permissions" SMALLINT DEFAULT 0 NOT NULL);
> > CREATE TABLE "oc_users" ("uid" VARCHAR(64) DEFAULT ' ' NOT NULL,
> "password" VARCHAR(255) DEFAULT ' ' NOT NULL, PRIMARY KEY (uid));
> > CREATE UNIQUE INDEX a_app_remotestorage_user ON "oc_authtoken" (user
> ASC, token ASC);
> > CREATE UNIQUE INDEX artist_name ON "oc_media_artists" (artist_name ASC);
> > CREATE UNIQUE INDEX bookmark_tag ON "oc_bookmarks_tags" (bookmark_id
> ASC, tag ASC);
> > CREATE UNIQUE INDEX id ON "oc_bookmarks" (id DESC);
> > CREATE INDEX path_index ON "oc_foldersize" (path ASC);
> > CREATE UNIQUE INDEX principals_members_index ON "oc_principalgroups"
> (principal_id ASC, member_id ASC);
> > CREATE UNIQUE INDEX uri ON "oc_principals" (uri ASC);
> >
> > oc_gallery_photos and oc_gallery_albums are empty and remain empty when
> hitting rescan.
> >
> > No notification appears when hitting rescan.
> >
> > Best
> >
> > Al_
> >
> > -------- Original-Nachricht --------
> >> Datum: Sat, 14 Jan 2012 17:46:47 +0100
> >> Von: Bartek Przybylski <bart.p.pl at gmail.com>
> >> An: Software at quantentunnel.de
> >> CC: owncloud at kde.org
> >> Betreff: Re: [Owncloud] thumbnails in gallery app
> >
> >> when you press rescan on top of the screen notification should appear
> >> (Creating thumbnails)?
> >> Also please provide your sqlite db scheme (for gallery) becasue there
> >> is possibility that scheme was not updated to latest version
> >> critical error logs might be stored in php logs, owncloud error log
> >> are stored in data/owncloud.log
> >>
> >> bartek
> >>
> >> 2012/1/14  <Software at quantentunnel.de>:
> >> > Sure.
> >> >
> >> > The server (actually an old computer used as media server with a 2 TB
> >> disk for /home and small disk for everything else):
> >> > Linux 2.6.32-37-generic-pae #81-Ubuntu
> >> > owncloud current master, commit 34a4784...
> >> > pictures all on /var/www/owncloud/... (i.e., no symbolic link to my 2
> TB
> >> disk).
> >> >
> >> > The client (less interesting): I trigger the rescan from Linux Ubuntu
> >> Natty, Firefox 9.0.1
> >> >
> >> > I manually deleteed the records, but not the tables, in owncloud.db
> >> (using sqlite3) and rm all pre-rendered thumbnails.
> >> > Then logged in from the client machine into my account, confirmed
> that
> >> all pictures exist (as files), then switched to the gallery app and hit
> >> rescan; no visible response.
> >> >
> >> > Are there any logs? I've seen that logging is forseen, but it seems
> not
> >> to be widely used. I diverted the logs to /var/log/owncloud.log, and I
> have
> >> set the logging level to debug.
> >> >
> >> > Best
> >> >
> >> > Al_
> >> >
> >> >
> >> >
> >> > -------- Original-Nachricht --------
> >> >> Datum: Sat, 14 Jan 2012 17:21:41 +0100
> >> >> Von: Bartek Przybylski <bart.p.pl at gmail.com>
> >> >> An: Software at quantentunnel.de
> >> >> CC: owncloud at kde.org
> >> >> Betreff: Re: [Owncloud] thumbnails in gallery app
> >> >
> >> >> Could you provide reproduction steps and setup environment because
> >> >> rescanning works for me
> > --
> > NEU: FreePhone - 0ct/min Handyspartarif mit Geld-zurück-Garantie!
> > Jetzt informieren: http://www.gmx.net/de/go/freephone

-- 
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