Page 1 of 1

using loads of pictures

PostPosted: Wed May 17, 2017 4:09 pm
by nick1461658753
Hi,

I'm building something based on a database with a lot of products, of those product we have 2 to 3 pictures per product (front, back, extra,...) these pictures are on our server and we have links in the database with the products "//sbs/location/to/picture.png"
I was importing the folders into the media in servoy, and started testing, and I was able to do this by replacing a few things in the url in the database so it is converted and I can use the ""media:///to/picture.png"

This all worked fine, so I decided to import all other folders into media, but servoy can't handle this, it fails on importing and gets super slow because it is just too many pictures (about 7600+ atm and this number keeps growing)

So what is the best way to include these pictures in my project? Can anyone give me a tip or a trick that helps me to make huge amounts of pictures in a local folder accesible in a servoy project?

thanks

Re: using loads of pictures

PostPosted: Wed May 17, 2017 5:19 pm
by Bernd.N
The media folder is intended especially for static pictures that belong to the application itself, like icons for buttons or country flags, but not for huge application data like in your case.
Here is already another thread that comes close to your question:
http://forum.servoy.com/viewtopic.php?f=22&t=21620

Re: using loads of pictures

PostPosted: Thu May 18, 2017 11:19 am
by nick1461658753
so I'm now trying it with a html area, but I get this error:

Not allowed to load local resource: file://sbs/location/to/picture.jpg

can't find where to place the pictures so the application can load them?

Re: using loads of pictures

PostPosted: Thu May 18, 2017 12:04 pm
by Bernd.N
I tried it myself this way for my smart client, and it worked well:

First I stored an example picture D:\1_EIMimages\telekom.png

Then in the .js file of the form on which I wanted to show the picture, I created a form variable at the top of that js:
Code: Select all
/**
* @type {String}
* @properties={typeid:35,uuid:"D4278DD3-F297-42EA-8950-8E5F816B4837"}
*/
var _sPicture = "";


Then I use a refreshUI() function like that:
Code: Select all
/** ok
* @param {Boolean} firstShow
* @param {JSEvent} event
* @private
* @properties={typeid:24,uuid:"76DF4321-55BA-42BF-B5F7-BD7D52928D8F"}
*/
function onShow(firstShow, event) {

        // ...

   refreshUI();
}

/** ok
* @param {JSEvent} event
* @private
* @properties={typeid:24,uuid:"4D317DF4-7647-4963-9809-C03185270163"}
*/
function onRecordSelection(event) {

   refreshUI();
}

/** ok
* @private
* @properties={typeid:24,uuid:"40C26F89-05C8-4DEC-8FE1-0035DFE21F27"}
*/
function refreshUI() {

   var sPictureFilename = "telekom.png";
   
   _sPicture = "<html><body><img src = 'file:///" + "D" + ":/" + scopes.security.tenantID +
            "_EIMimages/" +   sPictureFilename + "'></body></html>";
   


Finally, I created a media field with displayType HTML_AREA and dataProvider = _sPicture
It shows then the picture as it should.

Re: using loads of pictures

PostPosted: Thu May 18, 2017 1:10 pm
by nick1461658753
I tried it like this but keep getting

Not allowed to load local resource:...

Re: using loads of pictures

PostPosted: Thu May 18, 2017 1:27 pm
by Bernd.N
You can google that complete message with quotes around, seems to be quite common.
Looks like you tried it in webclient and the browser does not allow it.
As said I did that in smart client.

See for example here:
http://stackoverflow.com/questions/23969953/not-allowed-to-load-local-resource-file-c-jpg-java-ee-tomcat

Re: using loads of pictures

PostPosted: Sat May 20, 2017 2:38 pm
by mboegem
Hi,

So what exactly is your situation/usecase here?

So far we know it's about product images (multiple per product)
You mentioned having these on your server, but your request is how to get these a local files.

What kind of application are you building?
Is this a commercial product or an in house application?
Who needs to have access?

Sorry to ask so many questions, but it's the only way to get to a correct answer on your question.

For example, you could copy the photo's to a folder in the root-path of the tomcat server.
That way your files are directly hosted by the Servoy Application server, and you can access them as:
Code: Select all
http://myappserverip:port/myImageFolder/myImage001.jpg

However by doing this, and in the case of exposing this server to the internet, every single person on the planet can have access to your images.

Pls give us a bit more information and I think we can come up with a plan.