Forum for discussing general topics related to Couch.
3 posts Page 1 of 1
So i have a scenerio where it would be very nice to get a preview of a file uploaded by a user/employee, i will explain furter!

I have a HR Management System made with couch cms. I have 2 sections, one for super admin and one for employee (access_level=2)

The employee can submit a db form called Absence if he/her gets sick and cant come to work.

In this form he/her can upload a document from docktor confirming the absence.

When the form is submitted i super admin gets a mail notification telling me that i must login and manage the absence sent in!

Here i will look at all info left by employee and write a comment and save with status APPROVED or DECLINED! When submitted the employee gets mail with info about what i have written and if the absence is approved or diclined.

So all of this works amazing but here comes my question to make it even better!

The employee uploaded a doc from doctor, and as it is today i must download the doc to computer.

What i want is to have is a button and when clicking this button a modal window opens with a preview of the file so i can view and read the file direct without downloading the file!

I use securefil today and i know there is some limitations here, but if ONLY super admin will have access i would beleve there should be some possebilities!

Or maybe there is another solution to use some convert doc file to image?!

All ideas and feedback are welcome with big gratitude :)
Hi :)

The attachment (uploaded using securefile or any other method) is, nevertheless, not an image. So to show its preview in a modal window, we'll have to somehow create an image of it (or rely on browser addons that can render that file extension, which cannot be a preferred solution).

I have come across some scripts that can convert PDF to image. Probably there would be scripts that do the same with other file formats but I don't know of them. Perhaps our members could chip in if they have information ?
If you have placed restrictions on the kind of files that can be uploaded, perhaps such scripts could help.
Thanks for quick reply KK, yes i did also read a little in google about this and i think i maybe found a solution for this!

I leave the link her:

https://github.com/spatie/pdf-to-image

So i will try this and see if this will do the trick :)
3 posts Page 1 of 1