How to load images from ossn_data to display it

Adrian Räuchle Posted in Component Development 7 years ago

Hey,
i am trying to display an image on my page which was uploaded.

the image is stored in ossn_data/1/folder/image.png.

how would i display it in browser?
Would be cool if someone would provide an example.

Replies
German Adrian Räuchle Replied 7 years ago

okay Arsalan.
i managed to do it now :)
thanks for your help with it :)

German Adrian Räuchle Replied 7 years ago

@Arsalan Sha:

How about if a file is not uploaded with a form, but captured with webcam? how can i register that?

German Adrian Räuchle Replied 7 years ago

whats the difference between the type: object, user and annotation?

German Adrian Räuchle Replied 7 years ago

ah shit.

The thing is that the images shouldnt be available on the page its just for an internal process.
So only admins should see those images.

so i did it with just moveuploadedfile

Indonesian Arsalan Shah Replied 7 years ago

You can take a look at OssnProfile photo upload action and OssnPhoto class.

Indonesian Arsalan Shah Replied 7 years ago

The image must be uploaded via OssnFile and the image can be owned by (object, user or annotation)

After fetching the file you need to use following :

$path = $file->getPath();
fread($path) or file_get_contents($path);

How did you uploaded file?