I am currently developing application in Apex and I am lost. I have requirement that on hoovering over name/surname column in employee table it should bring image of employee. Image should not be stored in database it should rather by a pointer to… well FTP ? What is best practice to store images for DB but not in DB?
I understand that it is complex problem that have many steps therefore any help would be greatly appreciated.
I am currently developing application in Apex and I am lost. I have requirement
Share
As Jeffrey says (and i’d react in a comment, but then i started typing…), you will have to decide on how and where you’ll store your images. Blob columns are already out of the picture, so they’ll have to be put on a filesystem somewhere. This could be your apex_images folder for example, or a folder anywhere else on the server. You can always check by setting up an
imgtag on a page in your application, setting thesrcattribute to the image location.Another consideration would be just how you are going to link the images to an employee, and how the images are to be maintained.
What will their filenames be? By ID? By employee name?
I’ve been in this situation too, and it was a such an enormous hassle too. I received a folder with images in it, all numbered up. Until some anomalies popped up of course: there were people with an identical number, because they had only been using part of a unique key. And many and more incorrectly named pictures:
z.jpg, x.jpg, zzz.jpg, bob.jpg, mary.jpg.If going for names, how? And how to deal with special symbols in names, such as accents:
é,à,ç,.... Important of course, since you might not be able to link images to an employee because their name contains a special character but he image file doesn’t.And what about long names, or middle names?
Maria De La Santagosa-GurçaTotally random name, but you catch my drift. That might be someone’s real name, although the usually used name would beMaria Santagosa, which really isn’t too far fetched.Let’s suppose you will give images a unique key value, such as a generated
IDfield of your employee record.Perhaps the image can be made, the name can be copied and pasted in a column of the employee record.
I suppose the most important question would be: who will be maintaining the pictures?
If, say, Human Resources will be doing this, you’ll have to carefully explain those steps: create an employee, copy the ID field (which honestly is totally meaningless to them – and rightfully so), and name the jpg EXACTLY that way.
Yet another consideration is filetype, and whether they’ll get mixed up (again: who will maintain?).
And how about size? Will it be thumbnails or large size? Will the browser resize them? Probably the size of your database and amout of images are of consideration, and the load on your systems. If large pictures are not required, it’d be non-performant to actually drag those large images over the lines every time.
Believe me when i say that images not matching up to employees will be common, and that you should be aware of this. In my opinion, that is simply the case of the filesystem being easier tampered on that it would be on a database record.
Maybe consider the reasons for not choosing database storage again. Again, in my opinion, a profile picture is just as much a piece of structured data as is the employee name, and has more of a place in the database than on a filesystem. Maintaining the picture of an employee doesn’t even have to be hard. HR would probably have a maintenance application where they can view and edit all details of an employee. Displaying the image would be trivial, and providing an update and delete method just as much.
I’m not going to step into the detail of providing a floating image. First decide on storage location and the details, then take the next step of setting up img tags and see how that works. Then set up a single
imgtag, and use javascript to dynamically alter thesrcof the tag. Floating a selection would be next.