data-uri

Convert byte string to base64-encoded string (output not being a byte string)

浪子不回头ぞ 提交于 2020-02-23 09:35:07
问题 I was wondering if it is possible to convert a byte string which I got from reading a file to a string (so type(output) == str ). All I've found on Google so far has been answers like How do you base-64 encode a PNG image for use in a data-uri in a CSS file?, which does seem like it would work in python 2 (where, if I'm not mistaken, strings were byte strings anyway), but which doesn't work in python 3.4 anymore. The reason I want to convert this resulting byte string to a normal string is

Image with data uri src not loading in UIWebView

时光总嘲笑我的痴心妄想 提交于 2020-01-23 17:59:09
问题 I have a simple image populated from a data uri that loads fine in MobileSafari, but when I load the same webpage in a UIWebView, it shows as a broken image: <img src="data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAAQABAAD/2wCEAAkGBxQSEhQUEhQUFBUUFBQUFBcVGBUUFhUVFRUWFhQUFBQYHSggGBolHBQUITEhJSkrLi4uFx8zODMsNygtLisBCgoKDg0OGhAQGiwkHx8sLCwsLCwsLCwsLCwsLCwsLCwsLCwsLCwsLCwsLCwsLCwsLCwsLCwsLCw3NyssLC4rLP/AABEIAMEBBQMBIgACEQEDEQH/xAAcAAABBQEBAQAAAAAAAAAAAAABAAIDBAUGBwj

“unknown protocol: data” when using data URIs in IMG tags displayed by JavaFX WebView

。_饼干妹妹 提交于 2020-01-23 02:58:04
问题 Apologies for the title, I tried to be concise, but it's hard to be in this case. I'm building an application that uses JavaFX's WebView class to display a list of SVG images. Because they need to fit into their parents' width (which can change), I was forced to use <img> tags with data URIs rather than inline <svg> (I won't go into detail on this problem here, but it's a flaw of the WebKit engine used by WebView which prevents <svg> elements from adjusting their height according to their

How to “download” from data: URIs?

大城市里の小女人 提交于 2020-01-11 10:28:09
问题 I have a data: URI that I need to “download” (read: load as a stream or byte array) using the normal .Net WebClient / WebRequest . How can I do that? I need this because I want to display a XAML file generated from SVG, which includes some images using data: URIs. I don't want to always parse the XAML, save the images to disk and then change the XAML to point to the files. I believe WPF uses WebRequest internally to get those images. 回答1: You can use WebRequest.RegisterPrefix() to do that.

How to “download” from data: URIs?

寵の児 提交于 2020-01-11 10:28:08
问题 I have a data: URI that I need to “download” (read: load as a stream or byte array) using the normal .Net WebClient / WebRequest . How can I do that? I need this because I want to display a XAML file generated from SVG, which includes some images using data: URIs. I don't want to always parse the XAML, save the images to disk and then change the XAML to point to the files. I believe WPF uses WebRequest internally to get those images. 回答1: You can use WebRequest.RegisterPrefix() to do that.

PHP output DataURI base64_encode

匆匆过客 提交于 2020-01-05 07:13:55
问题 I want to take a local image, resize it and output the dataURI. Why is my base64_encode code not working? <?php // Create an image instance $imagearray = array('pop3', 'aboutme', 'passions', 'lindahlstudios', 'blog'); foreach ($imagearray as $key) { echo $key; //load image $im = imagecreatefrompng($key.'button4.png'); //set width of resize $width = 70; $ratio = $width / imagesx($im); $height = imagesy($im) * $ratio; echo ' resizeTo-'.$width.'x'.$height.'<br>'; $new_image =

Fonts missing from SVG file when placed in <img> data URI or <canvas>

偶尔善良 提交于 2020-01-03 17:25:51
问题 I am checking the use of fonts in SVG and the Canvas (html5). I have translated a svg file in urldata. I got this result: data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIj8+Cjxzdmcgd2lkdGg9IjYxMiIgaGVpZ2h0PSIzOTQiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+CiA8ZGVmcz4KICA8c3R5bGUgdHlwZT0idGV4dC9jc3MiPkBpbXBvcnQgdXJsKGh0dHA6Ly8xMjcuMC4wLjE6ODAwMC9WZWdhRWRpdG9yL3N0YXRpYy9Nb2RlbGVQb2wvRGVzeXJlbC5jc3MpPC9zdHlsZT4KIDwvZGVmcz4KIDxnPgogIDx0aXRsZT5DYWxxdWUgMTwvdGl0bGU

Why would CSS data-URIs be logged as 404 requests?

北城以北 提交于 2020-01-02 05:23:08
问题 To reduce the number of requests across our site we are using CSS data-URIs rather than linking to external images. For some reason, these data-URIs are occasionally still being logged as a 404 request against our servers. Why would this be happening? Random details: We are using Splunk to track Happens with multiple data-URIs Happens on all browsers On multiple pages throughout our site Our QA has not been able to duplicate the issue Below are the results from a specific data-URI Relevant

Using an Data URI SVG as a CSS background image

帅比萌擦擦* 提交于 2019-12-30 03:04:08
问题 Backstory: Goal: create a triangular shadow that can be applied via CSS and is scale-independant (i.e. a vector, not a raster image) After much research (tho I'm certainly open to alternatives) I chose to use an SVG background image as a data uri (to avoid the extra HTTP request). I know that this can work: http://jsfiddle.net/6WAtQ/ Where I'm stuck: I created a simple svg triangle, with a Gaussian blur effect, if it's written directly in the HTML (as opposed to the CSS) the svg works