From c9b918d330b74b82f4e61cfa537674bcd53ade5f Mon Sep 17 00:00:00 2001 From: Thomas Holder Date: Sat, 3 Nov 2018 22:34:23 +0100 Subject: Image HTTP support Uses Gio::File::load_contents (via URI::getContents) to load images from non-file/non-data URIs. Depends on GVfs. --- src/object/sp-image.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src/object/sp-image.cpp') 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 +#include #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); + } } } -- cgit v1.2.3