summaryrefslogtreecommitdiffstats
path: root/src/object
diff options
context:
space:
mode:
authorThomas Holder <thomas@thomas-holder.de>2018-11-03 21:34:23 +0000
committerTavmjong Bah <tavmjong@free.fr>2018-11-04 16:24:42 +0000
commitc9b918d330b74b82f4e61cfa537674bcd53ade5f (patch)
tree6b5f3cf85593cf375850b53908b1cfc13e557573 /src/object
parentAdd --preload option. (diff)
downloadinkscape-c9b918d330b74b82f4e61cfa537674bcd53ade5f.tar.gz
inkscape-c9b918d330b74b82f4e61cfa537674bcd53ade5f.zip
Image HTTP support
Uses Gio::File::load_contents (via URI::getContents) to load images from non-file/non-data URIs. Depends on GVfs.
Diffstat (limited to 'src/object')
-rw-r--r--src/object/sp-image.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/object/sp-image.cpp b/src/object/sp-image.cpp
index a66bb3625..ee0efc720 100644
--- a/src/object/sp-image.cpp
+++ b/src/object/sp-image.cpp
@@ -25,6 +25,7 @@
#include <2geom/rect.h>
#include <2geom/transforms.h>
#include <glibmm/i18n.h>
+#include <giomm/error.h>
#include "display/drawing-image.h"
#include "display/cairo-utils.h"
@@ -590,6 +591,13 @@ Inkscape::Pixbuf *sp_image_repr_read_image(gchar const *href, gchar const *absre
if (url.hasScheme("file")) {
auto native = url.toNativeFilename();
inkpb = Inkscape::Pixbuf::create_from_file(native.c_str(), svgdpi);
+ } else {
+ try {
+ auto contents = url.getContents();
+ inkpb = Inkscape::Pixbuf::create_from_buffer(contents, svgdpi);
+ } catch (const Gio::Error &e) {
+ g_warning("URI::getContents failed for '%.100s'", href);
+ }
}
}