[chronojump] LoadAndResize image should work on windows remote hard disk
- From: Xavier de Blas <xaviblas src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [chronojump] LoadAndResize image should work on windows remote hard disk
- Date: Thu, 15 Feb 2018 16:52:37 +0000 (UTC)
commit 6b469742de9eabef9d59464f5ae0d35cb1475bee
Author: Xavier de Blas <xaviblas gmail com>
Date: Thu Feb 15 17:52:10 2018 +0100
LoadAndResize image should work on windows remote hard disk
src/utilMultimedia.cs | 17 +++++++++++++++--
1 files changed, 15 insertions(+), 2 deletions(-)
---
diff --git a/src/utilMultimedia.cs b/src/utilMultimedia.cs
index 8dd7043..876e8b9 100644
--- a/src/utilMultimedia.cs
+++ b/src/utilMultimedia.cs
@@ -74,14 +74,27 @@ public class UtilMultimedia
public static bool LoadAndResizeImage(string filenameOriginal, string filenameDest, int width, int
height)
{
+ /*
+ * to avoid problems on windows with original images on remote hard disk,
+ * 1st copy to temp and then resize
+ */
+
+ string tempfile = System.IO.Path.GetTempFileName();
ImageSurface imgSurface;
+
if(GetImageType(filenameOriginal) == ImageTypes.PNG)
{
- imgSurface = LoadPngToCairoImageSurface(filenameOriginal);
+ //imgSurface = LoadPngToCairoImageSurface(filenameOriginal);
+ tempfile += ".png";
+ File.Copy(filenameOriginal, tempfile, true);
+ imgSurface = LoadPngToCairoImageSurface(tempfile);
}
else if(GetImageType(filenameOriginal) == ImageTypes.JPEG)
{
- imgSurface = LoadJpegToCairoImageSurface(filenameOriginal);
+ //imgSurface = LoadJpegToCairoImageSurface(filenameOriginal);
+ tempfile += ".jpg";
+ File.Copy(filenameOriginal, tempfile, true);
+ imgSurface = LoadJpegToCairoImageSurface(tempfile);
}
else //(GetImageType(filenameOriginal) == ImageTypes.UNKNOWN)
{
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]