- th = ((unsigned long) e->tw * ih) / iw;
- if (th < 1) th = 1;
-@@ -738,7 +756,7 @@ void
- epsilon_thumb_size(Epsilon *e, Epsilon_Thumb_Size size)
- {
- if (!e) return;
--
-+
- switch (size)
- {
+- ww = e->tw;
+- hh = (e->tw * ih) / iw;
+- if (hh > e->th)
++ if ((iw > ih && e->tw > 0) || e->th <= 0)
++ {
++ ww = e->tw;
++ hh = (e->tw * ih) / iw;
++ }
++ else
+ {
+ hh = e->th;
+ ww = (e->th * iw) / ih;
+@@ -647,9 +658,12 @@ epsilon_generate (Epsilon * e)
+ alpha = evas_object_image_alpha_get(im);
+ if ((iw > 0) && (ih > 0))
+ {
+- ww = e->tw;
+- hh = (e->tw * ih) / iw;
+- if (hh > e->th)
++ if ((iw > ih && e->tw > 0) || e->th <= 0)
++ {
++ ww = e->tw;
++ hh = (e->tw * ih) / iw;
++ }
++ else
+ {
+ hh = e->th;
+ ww = (e->th * iw) / ih;
+@@ -667,7 +681,7 @@ epsilon_generate (Epsilon * e)
+ if (data)
+ {
+ snprintf(buf, sizeof(buf), "file://%s", e->src);
+- _epsilon_file_name(e->tw, e->hash, "png", buf2, sizeof(buf2));
++ _epsilon_file_name(e->tsize, e->hash, "png", buf2, sizeof(buf2));
+ /* this is wrong - but hey! good enough? */
+ if (ext) snprintf(buf3, sizeof(buf3), "image/%s", ext);
+ else snprintf(buf3, sizeof(buf3), "image/png");
+@@ -706,14 +720,41 @@ epsilon_thumb_size(Epsilon *e, Epsilon_Thumb_Size size)