From df7bb0110d15f989d979c10b397da310be3eb1e7 Mon Sep 17 00:00:00 2001 From: codewarrior Date: Thu, 8 Dec 2005 07:55:10 +0000 Subject: [PATCH] - add method to fetch a thumb's width and height without having to decode the pixels. SVN revision: 18906 --- src/bin/e_thumb.c | 46 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) diff --git a/src/bin/e_thumb.c b/src/bin/e_thumb.c index 68354cbf3..17948142b 100644 --- a/src/bin/e_thumb.c +++ b/src/bin/e_thumb.c @@ -138,6 +138,52 @@ e_thumb_file_get(char *file) return strdup(thumb); } +/* return the width and height of a thumb, if from_eet is set, then we + * assume that the file being passed is the thumb's eet + */ +void +e_thumb_geometry_get(char *file, int *w, int *h, int from_eet) +{ + Eet_File *ef; + + if(!from_eet) + { + char *eet_file; + + eet_file = _e_thumb_file_id(file); + if(!eet_file) + { + if(w) *w = -1; + if(h) *h = -1; + return; + } + ef = eet_open(eet_file, EET_FILE_MODE_READ); + if (!ef) + { + if(w) *w = -1; + if(h) *h = -1; + return; + } + } + else + { + ef = eet_open(file, EET_FILE_MODE_READ); + if (!ef) + { + if(w) *w = -1; + if(h) *h = -1; + return; + } + } + if(!eet_data_image_header_read(ef, "/thumbnail/data/", w, h, NULL, NULL, + NULL, NULL)) + { + if(w) *w = -1; + if(h) *h = -1; + return; + } +} + /* return true if the saved thumb exists OR if its an eap */ int e_thumb_exists(char *file)