# Help with inserting picture reference from a web address

**URL:** <https://forum.servoy.com/t/help-with-inserting-picture-reference-from-a-web-address/6779>\
**Category:** Classic Servoy\
**Created:** [November 24, 2006, 11:08am UTC](https://forum.servoy.com/t/help-with-inserting-picture-reference-from-a-web-address/6779 "2006-11-24T11:08:55Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Gordon](https://avatars.discourse-cdn.com/v4/letter/g/3da27b/32.png) [@Gordon](https://forum.servoy.com/u/Gordon)\
**Post date:** [November 24, 2006, 11:08am UTC](https://forum.servoy.com/t/help-with-inserting-picture-reference-from-a-web-address/6779/1 "2006-11-24T11:08:55Z")

</div>

Hi Guys

I have been given 700 images that are stored in a web site images folder. I have created 700 records with the image name, description etc and want to show the image to the user so they can add descriptions.

In Filemaker you can use the Troi plugin to import references to the images and display them in a container field, can you do the same with Servoy and if so can anyone give me a steer in the right direction.

I have tried

globals.Image = plugins.images.getImage(“[http://x1.clickdigital.com/10scc/images/ddaimages/1002\_7.jpg](http://x1.clickdigital.com/10scc/images/ddaimages/1002_7.jpg)”);

The path is correct and works on its own, I stcuk this onto a onLoad script to try and get them image to load into a media formatted global

and

globals.Image = plugins.file.readFile(“[http://x1.clickdigital.com/10scc/images/ddaimages/1002\_7.jpg](http://x1.clickdigital.com/10scc/images/ddaimages/1002_7.jpg)”);

This fails as it pops up the file dialogue!

Some help on how or a steer in the right direction would be very much appreciated !

Cheers  
Gordon

---

<div class="post-metadata">

**Author:** ![IT2Be](https://avatars.discourse-cdn.com/v4/letter/i/dc4da7/32.png) [@IT2Be](https://forum.servoy.com/u/IT2Be)\
**Post date:** [November 24, 2006, 12:04pm UTC](https://forum.servoy.com/t/help-with-inserting-picture-reference-from-a-web-address/6779/2 "2006-11-24T12:04:15Z")

</div>

would elements.elementsname.setImageURL() do it for you?

You are trying to retrieve an image by url, that will not work…

---

<div class="post-metadata">

**Author:** ![cybersack](https://avatars.discourse-cdn.com/v4/letter/c/7cd45c/32.png) [@cybersack](https://forum.servoy.com/u/cybersack)\
**Post date:** [November 25, 2006, 11:10am UTC](https://forum.servoy.com/t/help-with-inserting-picture-reference-from-a-web-address/6779/3 "2006-11-25T11:10:14Z")

</div>

Gordon, you can simply use the data stream plugin (which you already use) to read from the URL and place it into either the media cell in the databse or a place on the Servoy server file system.

---

<div class="post-metadata">

**Author:** ![Gordon](https://avatars.discourse-cdn.com/v4/letter/g/3da27b/32.png) [@Gordon](https://forum.servoy.com/u/Gordon)\
**Post date:** [November 25, 2006, 11:55am UTC](https://forum.servoy.com/t/help-with-inserting-picture-reference-from-a-web-address/6779/4 "2006-11-25T11:55:11Z")

</div>

> cybersack:  
> Gordon, you can simply use the data stream plugin (which you already use) to read from the URL and place it into either the media cell in the databse or a place on the Servoy server file system.

Thanks Julian - problem solved in probably the least elegant way but the clients happy and working on it !! Gordon ![:oops:]( "Embarassed")

---

<div class="post-metadata">

**Author:** ![cybersack](https://avatars.discourse-cdn.com/v4/letter/c/7cd45c/32.png) [@cybersack](https://forum.servoy.com/u/cybersack)\
**Post date:** [November 25, 2006, 8:59pm UTC](https://forum.servoy.com/t/help-with-inserting-picture-reference-from-a-web-address/6779/5 "2006-11-25T20:59:06Z")

</div>

By ‘least elegant’ it sounds like you’re copying it locally and then pushing it up to the Servoy server (???)

If you are, then you can instead achieve it all in one pass ![:)]( "Smile")

Go to the mod\_cybersack form named ‘DataStream\_Records\_API’.  
There is already a demo Servoy method which does exactly this.  
It is called ‘streamUrlMediaToDatabase’.  
It contents are :

> var serverName = currentcontroller.getServerName();  
> var filename = url;  
> var asink = (globals.async == “asynchronous”);
> 
> plugins.DataStreamer.writeRecordBinaryAsStream(  
> mediaid, //the primary key  
> ‘mediaid’, //the primary key column  
> ‘media’, //the table name  
> ‘media’, //the data column name  
> ‘has\_media’, //the data-present column name  
> filename, //the url to stream in  
> mimetype, //the mimetype which should be employed whilst loading the data in this instance (useful to override the value read from the mimetype column)  
> ‘mimetype’, //the mimetype column-name  
> null, //passing null as the display name means that the file portion of the ‘filename’ attribute above will be used; you can insert a value to override this  
> ‘display\_name’, //the name of the column which stores the display name  
> asink, //should this run asynchronously ?  
> serverName //the server name  
> );

So, the argument named ‘filename’ accepts the input.  
If your filename has a value, for example, of:

> “[http://x1.clickdigital.com/10scc/images/ddaimages/1002\_7.jpg](http://x1.clickdigital.com/10scc/images/ddaimages/1002_7.jpg)”

then that content wil be streamed directly into the specified database record ![:)]( "Smile")
