View Single Post
Old 04-10-2010, 05:02 AM   #7
Iņigo
Guru
Iņigo did not drink the Kool Aid.Iņigo did not drink the Kool Aid.Iņigo did not drink the Kool Aid.Iņigo did not drink the Kool Aid.Iņigo did not drink the Kool Aid.Iņigo did not drink the Kool Aid.Iņigo did not drink the Kool Aid.Iņigo did not drink the Kool Aid.Iņigo did not drink the Kool Aid.Iņigo did not drink the Kool Aid.Iņigo did not drink the Kool Aid.
 
Posts: 730
Karma: 72743
Join Date: Feb 2008
Location: Here or there
Device: iRex iLiad, iRex DR800S. K4NT. Kobo Aura, Aura One, Libra 2.
Quote:
Originally Posted by Mr. X View Post
Oh- one more question I had was if the thumbnail blob has to be a .png or if .jpg is also allowed?
They are saved as png data.
You can select the data from thumbnails table and and just use or save as .png file, no need for any modification.

Code:
[inigo@inigo eReader]$ sqlite3 global.db
SQLite version 3.6.20
Enter ".help" for instructions
Enter SQL statements terminated with a ";"
sqlite> .schema thumbnails
CREATE TABLE thumbnails (
  file_id            INTEGER PRIMARY KEY NOT NULL,
  thumb_data_mini    BLOB,
  thumb_data_small   BLOB,
  thumb_data_medium  BLOB,
  thumb_data_large   BLOB
);
CREATE TRIGGER fki_thumbnails_file_id
BEFORE INSERT ON thumbnails
FOR EACH ROW BEGIN
	SELECT RAISE(ROLLBACK, 'insert on table "thumbnails" violates foreign key constraint "file_metadata" (file_id)') WHERE (SELECT file_id FROM file_metadata WHERE file_id = NEW.file_id) IS NULL;
END;
CREATE TRIGGER fku_thumbnails_file_id
BEFORE UPDATE ON thumbnails
FOR EACH ROW BEGIN
	SELECT RAISE(ROLLBACK, 'update on table "thumbnails" violates foreign key constraint "file_metadata" (file_id)') WHERE (SELECT file_id FROM file_metadata WHERE file_id = NEW.file_id) IS NULL;
END;
sqlite> select thumb_data_small from thumbnails where file_id == 2515;
�PNG


sqlite>
Iņigo


EDIT: ok, I'm reading carefully now... you asked if jpeg could be used besides png. Sorry.

Last edited by Iņigo; 04-10-2010 at 07:06 AM.
Iņigo is offline   Reply With Quote