Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Set background-image to a blob: URI

Tags:

css

I have a background image stored in a BLOB, say blob:http://lhost/3dbeb143-a618-46f3-8fa2-25f8dd477692.

I want to set the background-image property of an element to this blob.

I tried setting it to url("http://isequence/3dbeb143-a618-46f3-8fa2-25f8dd477692") but it just says isequence/3dbeb143-a618-46f3-8fa2-25f8dd477692: 404 Not Found. Clearly it is trying to request that file literally through HTTP.

So how do I go through with this?

like image 484
Joseph Avatar asked Aug 07 '16 04:08

Joseph


People also ask

How do I add a background image to a container?

Steps to set the background image: Step 1: Add the Container widget. Step 2: Add the decoration parameter (inside Container) and assign the BoxDecoration class. Step 3: Add the image parameter (inside BoxDecoration) and assign the DecorationImage class.

How do I put a background on my header?

Change the color or image of the header Go to the Design tab. Click Customize to expand the set of choices for customizing your theme. Click Header Image to choose an image to be the background of the header. Click Header background to choose a color for the header section.

Is Blob a URL?

Blob URLs contain pseudo protocols that can create a temporary URL to audio and video files. This type of URL essentially acts as a fake source for the media on the website, so you can't download it directly. Instead, you have to use third-party conversion tools. First, however, you have to find the blob URL itself.


1 Answers

Try this:

<script>
var tmp_path = URL.createObjectURL('path/to/image.png');
document.getElementbyId('divId').style.background = url(tmp_path);
</script>
like image 83
JosephDFGX Avatar answered Oct 23 '22 01:10

JosephDFGX