Hi,
I added a little bit of code to image.c which does a tolower() on the
file extension. I know this is a hack, but it works great for funny
file names, like Png and JPG.
Stafford
On Tue, 2004-05-11 at 22:29, Corey Donohoe wrote:
> k, I think you have an old version. My code from a fresh cvs update
> looks like this. I ran into this in the past as well, and ended up
> fixing it (if you can call it that) with the same idea you suggested.
>
> imlib_save_image_with_error_return(tmpfile, &err);
> evas_image_cache_flush(evas_object_evas_get(im->obj));
> switch (err)
> {
> case 0:
> unlink(im->filename);
> if (!rename(tmpfile, im->filename))
> result = 1;
> break;
> default:
> fprintf(stderr, "Unable to save file(%d)", (int) err);
> break;
> }
>
> Considering .JPG files pop up every so often maybe some concession needs
> to be made in order to support them better. Tho the default saver is
> .jpg iirc.
>
>
> On Tue, 2004-05-11 at 03:26, Stafford Horne wrote:
> > Hello,
> >
> > I don't seem to be able to connect to the CVS server right now so I
> > can't easily make a patch. But I can explain.
> >
> > When trying to save changes to an image in Entice if there is an
> > error during saving the image will be deleted. Thats not very good.
> >
> > Here is what we need to to.
> >
> > in the
> > file image.c
> > function entice_image_save
> >
> > this line.
> > unlink(im->filename);
> >
> > Should be moved into the case statement. That way we only delete the
> > image if we were able to create the temporary image.
> >
> > You know what I mean??
> >
> > As for the cause of this Error in the first place. This I am guessing is
> > because:
> >
> > if ((tmp = strrchr(im->filename, '.')))
> > imlib_image_set_format(tmp + 1);
> >
> > is used for the image format stuff, so i am guessing my file had a bad
> > file extension (JPG) and there was an error saving. I am not to sure
> > what imlib_image_set_format supports. so I am not going to try and fix
> > it because I can't even download the imlib2 source right now.
> >
> > Stafford
> >
Index: image.c
===================================================================
RCS file: /cvsroot/enlightenment/e17/apps/entice/src/bin/image.c,v
retrieving revision 1.45
diff -u -r1.45 image.c
--- image.c 27 Apr 2004 23:06:23 -0000 1.45
+++ image.c 15 May 2004 00:44:14 -0000
@@ -306,9 +306,16 @@
imlib_image_set_has_alpha((char)
evas_object_image_alpha_get(im->obj));
imlib_image_attach_data_value("quality", NULL, im->quality, NULL);
+
if ((tmp = strrchr(im->filename, '.')))
+ {
+ int i;
+ for(i = 1; i != strlen(tmp); i++)
+ tmp[i] = tolower(tmp[i]);
imlib_image_set_format(tmp + 1);
+ }
snprintf(tmpfile, PATH_MAX, "%s.%d", im->filename, getpid());
+
imlib_save_image_with_error_return(tmpfile, &err);
evas_image_cache_flush(evas_object_evas_get(im->obj));
switch (err)