View Issue Details

IDProjectCategoryView StatusLast Update
0010686ScribusImport / Exportpublic2012-05-25 17:20
Reporterale Assigned Tojghali  
PrioritynormalSeverityminorReproducibilityalways
Status closedResolutionfixed 
Product Version1.5.0 
Fixed in Version1.4.1.svn 
Summary0010686: [patch] html importer tries (and fails) to read embedded images
Descriptionif an image is embedded in an html file as <img style="height:2.5141cm;width:14.4889cm;" alt="" src="data:image/*;base64,iVBORw0KGgoAA...">, scribus will put the whole base64 encoded text into the text frame.

for a jpg this will bring scribus to its knees and make the content of the frame unusable.

the attached patch, will replace the content by the string "embedded image"
TagsNo tags attached.
Patch

Activities

ale

2012-04-18 16:38

manager  

discard_embedded_image.diff (551 bytes)   
Index: htmlreader.cpp
===================================================================
--- htmlreader.cpp	(revision 17445)
+++ htmlreader.cpp	(working copy)
@@ -218,7 +218,11 @@
 		{
 			if (attrs.localName(i) == "src")
 			{
-				imgline +=  " src: " + attrs.value(i);
+                if (attrs.value(i).indexOf("data:image") == -1) {
+                    imgline +=  " src: " + attrs.value(i);
+                } else {
+                    imgline +=  " src: embedded image";
+                }
 			}
 			if (attrs.localName(i) == "alt")
 			{
discard_embedded_image.diff (551 bytes)   

cbradney

2012-04-18 18:39

administrator   ~0027956

This is the easy way out... why can't we write the image to disk and then load it?

Also, re style and all those unnecessary braces..
+ if (attrs.value(i).indexOf("data:image") == -1) {
+ imgline += " src: " + attrs.value(i);
+ } else {
+ imgline += " src: embedded image";
+ }

should be:

+ if (attrs.value(i).indexOf("data:image") == -1)
+ imgline += " src: " + attrs.value(i);
+ else
+ imgline += " src: embedded image";

ale

2012-04-18 19:45

manager   ~0027958

the html importer does not recognize images when they are external...

but yes, it would be possible to add the image to disk or to insert it as an embedded frame (probably better).

ale

2012-04-19 11:11

manager   ~0027960

if you estimate that this patch solves the issues without leading to other problems, could anybody commit it before the next ppa is generated?

as you can read in the ML, antonio needs it for his work...

thanks
a.l.e

plinnell

2012-05-25 17:00

viewer   ~0028035

Should this not go into 1.4.2 as well ?

ale

2012-05-25 17:20

manager   ~0028036

from the "finxed in version" message, it already should be in 1.4.1...

Issue History

Date Modified Username Field Change
2012-04-18 16:38 ale New Issue
2012-04-18 16:38 ale File Added: discard_embedded_image.diff
2012-04-18 17:24 ale Description Updated
2012-04-18 17:24 ale Description Updated
2012-04-18 18:39 cbradney Note Added: 0027956
2012-04-18 19:45 ale Note Added: 0027958
2012-04-19 11:11 ale Note Added: 0027960
2012-04-19 20:55 jghali Status new => resolved
2012-04-19 20:55 jghali Fixed in Version => 1.4.1.svn
2012-04-19 20:55 jghali Resolution open => fixed
2012-04-19 20:55 jghali Assigned To => jghali
2012-04-29 10:52 cbradney Status resolved => closed
2012-05-25 17:00 plinnell Note Added: 0028035
2012-05-25 17:20 ale Note Added: 0028036