Binary Data Comparision and Image storage

Binary Data Comparision and Image storage

  

I am able to upload an image and save it in DB as Binary Data. Now, Before saving I want to compare the Binary Data size to particular value. How to compare it?


And after uploading the image is stored as Binary Data.  


Can I know where the image is stored in screen. Can I able to view that?

Solution

Hi Ajith,

The size of a Binary Data Variable can be obtained by using the BinaryDataSize Action from the BinaryData extension:

I don't understand your second question about "where the image is stored in [the] screen", can you explain?

Solution

Kilian Hekhuis wrote:

Hi Ajith,

The size of a Binary Data Variable can be obtained by using the BinaryDataSize Action from the BinaryData extension:

I don't understand your second question about "where the image is stored in [the] screen", can you explain?

Sorry it is server not screen. Can I know where the image is stored in server. Can I able to view that?


For example in case of java we will store the image in some path in server location. Similarly in this case?


Hi Ajith,

Right after the image is uploaded it is still only living client side, i.e. in the browser. When you press a button, the content of the file is sent to the server, but this is all still in-memory. You need to explicitly do something with the binary data, like storing it to an Entity. I suppose that's what you do, given your image:

So I'm not quite sure I understand your question about where it is stored, as you store it in the database?

Kilian Hekhuis wrote:

Hi Ajith,

Right after the image is uploaded it is still only living client side, i.e. in the browser. When you press a button, the content of the file is sent to the server, but this is all still in-memory. You need to explicitly do something with the binary data, like storing it to an Entity. I suppose that's what you do, given your image:

So I'm not quite sure I understand your question about where it is stored, as you store it in the database?


After uploading and saving the image in DB. Is the image will be stored only DB or in any other locations as well?


And while displaying the image, is the binary data is converted to image and it is getting displayed or by any other logic?

Hope you understand my question?

Hi Ajith,

The image will only be stored in the database, just like other data you store there.

The Binary Data is the exact representation of the image file. So if you have a JPEG image, the binary data will start with the JPEG file header, followed by the content. When displaying, the browser will use the file content to decode whatever picture data is in there, convert it to pixels etc. But that's the browser doing that, and has nothing to do with OutSystems.

Kilian Hekhuis wrote:

Hi Ajith,

The image will only be stored in the database, just like other data you store there.

The Binary Data is the exact representation of the image file. So if you have a JPEG image, the binary data will start with the JPEG file header, followed by the content. When displaying, the browser will use the file content to decode whatever picture data is in there, convert it to pixels etc. But that's the browser doing that, and has nothing to do with OutSystems.


Thank you Kilian its clear now.

Cheers

Hi Ajith,

You're welcome! Happy coding :)