# Image.src and revokeObjectURL

**URL:** <https://discourse.threejs.org/t/image-src-and-revokeobjecturl/23682>\
**Category:** Questions\
**Tags:** image, textures\
**Created:** [February 20, 2021, 9:19pm UTC](https://discourse.threejs.org/t/image-src-and-revokeobjecturl/23682 "2021-02-20T21:19:25Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![prominent](https://avatars.discourse-cdn.com/v4/letter/p/f08c70/32.png) [@prominent](https://discourse.threejs.org/u/prominent)\
**Post date:** [February 20, 2021, 9:19pm UTC](https://discourse.threejs.org/t/image-src-and-revokeobjecturl/23682/1 "2021-02-20T21:19:25Z")

</div>

```
loader.setPath( directory );
	loader.load( filename+ext, function (obj) {
		if(obj.hasOwnProperty('scene')) importModel.bufferObject = obj.scene;
		else importModel.bufferObject = obj;
		
		//get all the textures that the imported model uses
		importModel.uniqueImages = [];
		importModel.bufferObject.traverse( function(child) {
			if (child instanceof THREE.Mesh) {
				try{ if(importModel.uniqueImages.indexOf(child.material.map.image.src) == -1) importModel.uniqueImages.push(child.material.map.image.src); }catch{}
			}
		});
		
		//create the textures in our format
		importModel.uniqueImages = importModel.uniqueImages.filter(e => e != null);
		if(importModel.uniqueImages.length > 0){

		     image.src = importModel.uniqueImages[0];

        }
		else importModel.convertBufferObject();
	},function (obj) {},function (error) {
		error = String(error).replace("THREE.","");
		alert(error);
	});

```

In order to get the image.src to successfully load, I have to comment out URL.revokeObjectURL( sourceURI ); from the GLTFLoader module…

Is there a way to get the image loading without having to edit the module like that??

the image.src looks like this: “blob:chrome-extension://enjilmhmplefekkpbciadkljojpakhmd/54d7e9a6-ba95-4024-b67c-4b040304c0d9”

I wasn’t sure how to title this post…

---

<div class="post-metadata">

**Author:** ![prominent](https://avatars.discourse-cdn.com/v4/letter/p/f08c70/32.png) [@prominent](https://discourse.threejs.org/u/prominent)\
**Post date:** [February 21, 2021, 1:26am UTC](https://discourse.threejs.org/t/image-src-and-revokeobjecturl/23682/2 "2021-02-21T01:26:15Z")

</div>

Seems as though I can do this:

> ```
> if(typeof child.material.map.image.src !== 'undefined'){
> imageSrc = child.material.map.image.src;
> }else{
>   				
> let img = child.material.map.image;
> let canvas = document.createElement('canvas');
> canvas.width = img.width;
> canvas.height = img.height;
>   				
> let ctx = canvas.getContext('bitmaprenderer');
> if(ctx) {
> ctx.transferFromImageBitmap(img);
> }
> else {
> canvas.getContext('2d').drawImage(img,0,0);
> }
> imageSrc = canvas.toDataURL();
> canvas = null;
> ctx = null;
> }
> 
> ```

This will allows me to get the data without having to edit the modules.
