data-uri

BASE64 in HTML is not working

为君一笑 提交于 2019-12-21 17:15:35
问题 I had tried all possible way to display image using base64 string. But none of them are working. I tested it on IE6,7, Firefox 3. Please tell me what is wrong with below code. <head> <STYLE type="text/css"> div.image { width:100px; height:100px; background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADIA...); } </STYLE> </head> <body> <img src="data:image/jpg;base64,968" /> <img alt="Embedded Image" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADIA..." /> <script type="text

Are data URIs on <img>s XSS exploitable?

守給你的承諾、 提交于 2019-12-21 09:35:19
问题 After reading this article I don't have a clear answer: http://palizine.plynt.com/issues/2010Oct/bypass-xss-filters/ Will browsers interpret text/html data URI payload in <img> src as an document where <script> tags are executed? If not then is it safe to allow data URIs in third party HTML? What safety mechanisms exist at the browser level for this use case? 回答1: The MSDN documentation says IE does not: For security reasons, data URIs are restricted to downloaded resources. Data URIs cannot

How to get a rotated linear gradient svg for use as a background image?

巧了我就是萌 提交于 2019-12-20 17:42:09
问题 I've seen a few questions dancing around this, so I hope this isn't too redundant. Ideally, I'd like an image/svg+xml which scales to 100% of it's container. Colorzilla gets me a great start with a data:image/svg+xml <?xml version="1.0" ?> <svg xmlns="http://www.w3.org/2000/svg" width="100%" height="100%" viewBox="0 0 1 1" preserveAspectRatio="none"> <linearGradient id="grad-ucgg-generated" gradientUnits="userSpaceOnUse" x1="0%" y1="0%" x2="100%" y2="0%"> <stop offset="0%" stop-color="#ffffff

SVG Data URI doesn't render in img tag

 ̄綄美尐妖づ 提交于 2019-12-20 02:52:10
问题 I have a Data URI Base64 encoded string I am obtaining from the Kendo.drawing.exportSVG method from a Kendo Map. If I put the Base64 string into an SVG decoder, then save the resulting SVG to a file and open it in a browser the image displays fine, but if I put it into an <img> tag, nothing is displayed. The Base64 string is quite large, so I've put it in a JsFiddle to demonstrate rather than pasting it here. https://jsfiddle.net/qmap5sg9/ Can anyone advise why the image isn't loading? 回答1:

How to break lines in URLs in stylesheet

喜你入骨 提交于 2019-12-19 20:31:42
问题 I have a stylesheet with really long lines (data urls). Is there anyway I can break those lines into smaller lines? Example of long line: background-image: url(data: image/png;base64, really long string); 回答1: You do this by enclosing the URI in quotes, and appending a \ to the end of each line you want to break, followed by a newline, within the URI. The parser will treat the string in the URI as though the \ and the immediately following newline were not there. When doing this with a URI

A better test for base64 URI support (can I create a large base64-encoded image in JS?)

こ雲淡風輕ζ 提交于 2019-12-19 03:21:44
问题 I'm using Modernizr to detect the features supported in the browser our users are running, so far so good. But I've come up against a theoretical problem when testing for base64 compatibility. The patch for this support is detailed here, and works- except for a weird case with IE8- it only allows base64 encoded images of up to 32KB. I don't really want to embed a 32KB long base64 string inside my JS file, it'll add a crazy amount of bloat. So, could I create a 32KB- valid- image using JS? I'm

Blank image encoded as data-uri [duplicate]

霸气de小男生 提交于 2019-12-18 09:53:33
问题 This question already has answers here : Smallest data URI image possible for a transparent image (9 answers) Closed 3 years ago . I've built an image slider (based on the terrific bxSlider) which will preload images just-in-time before they slide into view. It's working pretty well already, but I don't think my solution is valid HTML. My technique is as follows: I generate the slider markup with the first slide image being inserted as usual (with an <img src="foo.jpg"> ) and subsequent

How can I convert image binary from API call to data URI in Javascript?

一曲冷凌霜 提交于 2019-12-18 04:12:41
问题 The Google API I'm using is transmitting images only as binary data. I have absolutly no idea how to put this into a data URI to display it, thanks for any help! The call I'm talking about is this API call. As you can see, it says: The server returns bytes of the photo. For the call (it's an extension), I use the chrome_ex_oauth methods. Maybe I need to add something into the header to get real binary data, not string as it comes in right now... What I need to do is to convert the resulting

How to parse data-uri in python?

£可爱£侵袭症+ 提交于 2019-12-17 20:52:02
问题 HTML image elements have this simplified format: <img src='something'> That something can be data-uri, for example: data:image/png;base64,iVBORw0KGg... Is there a standard way of parsing this with python, so that I get content_type and base64 data separated, or should I create my own parser for this? 回答1: Split the data URI on the comma to get the base64 encoded data without the header. Call base64.b64decode to decode that to bytes. Last, write the bytes to a file. from base64 import

Send a base64 image in HTML email

冷暖自知 提交于 2019-12-17 02:10:56
问题 Using a rich-text editor, our users can drag and drop a saved image from their desktop to the editor. The image appears and displays properly in the web page after they submit. Since the image is not uploaded anywhere, the editor saves the image as a base64-encoded image. <img alt="" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAA4QAAAFKCAIAAADKUQaBAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAP+lSURBVHhepP1p32zb etc. But it doesn't show up - not on the iPhone, nor