Image Media stuffs

Hi there,

I want to know how to get the file type (jpg, gif, doc, pdf, xls and others) of a file i am going to insert into a media field. To insert I use the following method.
media_content = application.readFile(media_file_path)

Also when I try to show an image in a media field where the file size is around 1.5mb then the system is crashed. Is it not recommended to show the file of that size or bigger?

Thanks

Anyone can give me some idea about this please…

Thanks a lot.
Hameed

Hi Hameed

Can’t respond re 1.5mb images crashing file - but have you seen tips from Harjo Kompagnie in Servoy Magazine. May be useful.

http://www.servoymagazine.com/home/2004 … put.html

Regards

Graham Greensall

1.5MB file shouldn’t be a problem
The only thing that really matters is the resolution. And how you display it.
Did you display it full size?

if you want to know the type then you have to store the type besides the media field.

I display it using the dimension 200x200. I am sure that I have crashed the client by adding a 2mb jpeg file.

Do we have a function to get the type of the file that I can store in a field for later use?

Thanks

can you send me an 2MB jpg file and a small solution that does crash at youre place?

currently you have to do it youreself if you want the type (with a file open dialog ect)

I could not reproduce this problem with a 2MB file. I will send you a sample solution when I get the problem again. But I would like know how to get the type of the file. Could you please show how to do it?

You have to store the type of file (read it from the path) and store it yourself in the database. Here’s currently no way to automatically “tell” what kind of binary is stored in a media column. This is because you can store ANY binary data in a media field (Word documents, spreadsheets, databases, whatever).

Hope this helps,

Bob Cusick

Ok. Thanks! I am using the file_extension to handle this now.