image from database

image from database

  

hi,

     i need to display a image in image widget from external mysql database.but i can't show the image, rather there is some error mark instead of image.

 i attached here the info i used.

please give your suggestions.

  thank you



 this is the issue actually.

Hello Chandru,

Could you show the data type of the image attribute in the entity?
Also, could you show the complete expression you're passing to the property Entity Identifier of the image widget?

Cheers.


Eduardo Jauch wrote:

Hello Chandru,

Could you show the data type of the image attribute in the entity?
Also, could you show the complete expression you're passing to the property Entity Identifier of the image widget?

Cheers


thank you for the reply sir,

datatype is binary data.

expression is

Hello Chandru,

Hum... If you go to Service Studio and open the Entity methods (with Vew option in context menu), do you see something in the field image or it is (0 bytes)?
Also, could you put here the structure of your entity, so we can see the identifier of it (I am assuming it is Name)?

Cheers.

Eduardo Jauch wrote:

Hello Chandru,

Hum... If you go to Service Studio and open the Entity methods (with Vew option in context menu), do you see something in the field image or it is (0 bytes)?
Also, could you put here the structure of your entity, so we can see the identifier of it (I am assuming it is Name)?

Cheers.

sir,

  there  BinaryData(12 bytes) is present under image attribute.yes here name is the identifier.

Ok.

I doubt your images have 12 bytes. As you uploaded them, you probably know the size and can tell if the file size is bigger (probably is).

So, I would say that you are not uploading the image, but instead, is just saving the path to it?
Could you confirm that your entity (in the external database), really have the image, being a blob or something field (and not a text one)?

Cheers.

Eduardo Jauch wrote:

Ok.

I doubt your images have 12 bytes. As you uploaded them, you probably know the size and can tell if the file size is bigger (probably is).

So, I would say that you are not uploading the image, but instead, is just saving the path to it?
Could you confirm that your entity (in the external database), really have the image, being a blob or something field (and not a text one)?

Cheers.

hello sir,

   yes there is a blob icon in the  database.


And what is the size of the images you uploaded to your database?
Maybe the process you took are not working as expected?

Eduardo Jauch wrote:

And what is the size of the images you uploaded to your database?
Maybe the process you took are not working as expected?

sir,it is 3.2kb


Ok, I think you're storyng the image in a wrong way, so in fact you're just saving the path.

Change your SQL to this (just an example):

VALUES
(LOAD_FILE('C:/Users/adity/Desktop/New folder/a.png'))

If it is MySQL your database, you need to inform that what you want to upload is the FILE that the path in the text points to.

By the way, is it MySQL? 

if there image's path only presented under image attribute means .how can i solve that sir?


(See my previous answer)

Eduardo Jauch wrote:

Ok, I think you're storyng the image in a wrong way, so in fact you're just saving the path.

Change your SQL to this (just an example):

VALUES
(LOAD_FILE('C:/Users/adity/Desktop/New folder/a.png'))

If it is MySQL your database, you need to inform that what you want to upload is the FILE that the path in the text points to.

By the way, is it MySQL? 

yes sir it is mysql database.and i am using workbench to manipulate it. if i am using same sql statement for inserting.it shows value as null.


chandru rajendran wrote:

yes sir it is mysql database.and i am using workbench to manipulate it. and i am using same sql statement for inserting.

From the FIRST image in your initial post, no, you're not.

Notice the LOAD_FILE in my suggestion. You don't have it.

Cheers


Eduardo Jauch wrote:

chandru rajendran wrote:

yes sir it is mysql database.and i am using workbench to manipulate it. and i am using same sql statement for inserting.

From the FIRST image in your initial post, no, you're not.

Notice the LOAD_FILE in my suggestion. You don't have it.

Cheers


if i am using loadfile() it shows null. 


Hi,

It's LOAD_FILE.
Also, you need FILE privileges to to it. The user you are using has it?

Check it here: https://dev.mysql.com/doc/refman/8.0/en/string-functions.html#function_load-file

Cheers.

Eduardo Jauch wrote:

Hi,

It's LOAD_FILE.
Also, you need FILE privileges to to it. The user you are using has it?

Check it here: https://dev.mysql.com/doc/refman/8.0/en/string-functions.html#function_load-file

Cheers.


hi sir,

   sir sorry for the non stopping  disturbinng.

what does it means that "the file must be located on the server host".if i has my file in my local pc means i can or can't.and can't means give me a solution sir

   please

The solution is: The file has to be in the server.

If your database is in a server in the cloud, for example, it does not have access to your computer. In this case, to use that method, you must first send the files to the server where the database is, so that when you execute your SQL the server can find the files.

If you can't do this, you will have to find a different way of uplaod the files for your server.

You can do an OutSystems application for that...

Cheers

Hi,

    For creating tables i am using workbench.then  Howcan I store my images in server database.?

Hello chandru,

I'm no expert in MySQL, but if you can read the table in an OutSystems application, why don't you create a page to upload files and save on your table?

Cheers.