Any help with understanding documents

Ok, I’m not a php dev; and am vague about what 'renders inside a <div></div> ’ implies for how to place an image on a template?
To be honest, the ability to put a letterhead graphic on a template is one of my original motivations for doing the latest doc upgrade :slight_smile:

Hi @htuck,
Sorry, i’ve been sick so late here.

You can add most any html anywhere in template. So, you can mix text and html or all html etc…
Some rules:

  • Don’t add a <html> or <body> tag but all other tags are fair game.
  • Don’t use html between <pre> tags. However, use pre tags if you want to format pure text i.e newlines e.t.c are honored.
  • Don’t use the {ParseAsHtml} unless html is not formatting correctly in mixed html/text templates.
  • Also if using Template Manager editor remember to use the code<> when inserting html.
  • Hold your tongue just right.:slight_smile:

So, here is an example of using an image in the Privacy Document template(just partial)
<img src="./../../sites/default/images/login_logo.gif"> <h4>HIPAA Declaration</h4>Given today: {DOS} OpenEMR Software makes it a priority to keep this piece of software updated with the most recent available security options, so it will integrate easily into a HIPAA-compliant practice and will protect our customers with at least the official HIPAA regulations. <em>The Practice:</em>

Hope this help!

Hi Jerry-
Well, heck, I saw this post in my email a couple days ago and replied to it but I guess it didn’t post back here.
This is wonderful news especially the relative URL to the image you included. Which is one of the files that are in the …/images/ directory by default.
Would I need to ssh in (or dive into the fs on a local system) to place my own images there, or do any of the file upload mechanisms in OpenEMR manage that?
I see I can do an inelegant hack by creating a dummy pt, uploading the images to their documents file at URL: file:///var/www/openemr/sites/default/documents/[PID]/[filename.jpg] then using ’ for the template images… but that’s an inelegant hack. How would one do it right?

  • HT

And also, hope your sickness is fleeing quickly!

1 Like

Yep, that’d be a way.

Or use Miscellaneous->New Documents which saves to:

Also note that I added a cool feature back in v5.0.0(I believe) that allows a practice to upload documents for any patient in that screen. This allows for easier uploads for many patients w/o having to load entire chart then goto Documents for each patient.

Might be helpful if I document that somewhere. Come on Jerry!:slight_smile:

Hi Jerry-- More template image uploading fun! Fired up my OpenEMR v5.0 on a VM. For what it’s worth, this is VBox VM on Linux Mint 18 using Mate DE.

Won’t bore with details, but I got into Admin/ Practice/ Documents and created a new category for FormImages. Then got into Misc/ New Docs and uploaded several images to different categories, all showing in the Documents tree, left half of big pic.

In the file explorer window on the right half of the pic, the left pane is what I have in ~…/default/documents; subdir 00 is for the unassigned files put into Misc/ New Docs; subdir 2 is the one pt’s PID who has docs uploaded.

Then I uploaded images to different categories in subdir 00, two in the FormImages and 2 into the top level ‘Categories’ category. They all ended up in different subdirectories in the filesystem.

Guess my question is, how can we know ahead of time which subdir names they’re going to end up in? Otherwise we can’t put a URL in the template.

Now on the other hand, I did upload a bunch of pics to different categories in a patient’s record ‘Documents’ collection (that ‘2’ guy) and they all ended up in the same directory in the fs. Could that inelegant dummy pt hack be the answer after all?


Didn’t realize 00 subdirectory cat id.
I suppose a work around could be as you suggest but preferable is to just add images to site image directory just as if a logo etc.

Really best solution is to modify Document Template to allow practice to easily upload images for the various image needs across OpenEMR

Fascinating! You guys are amazing.

@hitechelp better than TV, huh?

@sjpadgett yes, that mod would be preferable, wouldn’t it? But since it’ll probably take a while to mod the Docs Template and it being released, what do you think about putting in the docs that they can ssh the desired images into the …/sites/default/document/images/[filename] and use that url in their template, or the dummy pt method and use …/sites/default/documents/[PID]/[filename] in the template?
Or just leave the workarounds undocumented? They might be confusing. The workarounds are written up here, after all, and this post is mentioned in the docs.

For now i’d just give same instructions for image uploads as we give for practice logo uploads.

If wasn’t so hard to backport because of all code change differences between 503 and 502, i’d go ahead and do a solution but, i’m really swamped at the moment.

Also, this would be a good place to add wish list for this feature like additional tags/placeholders wanted etc…

Couple quick security and misc things:

  1. When things are placed in the 00 directory (not assigned to a patient yet), the thought was that the directory file limit may get hit, so random directory is created (i think from 0-10000 or so), and document is placed there.
  2. Everything in the sites/document/ directory can not be directly accessed by browser (apache is set to deny it; at least it better be).
  3. Almost everything stored in the sites/document/ directory is encrypted (or that is the goal at least) just in case item 2 breaks down or is not set correctly in apache.
  4. We removed functionality that allowed dropping files within places outside sites/document/ directory since it then becomes much tougher to prevent related vulnerabilities (bad things can then be uploaded and run directly from web browser).
1 Like

Ok, I understand that the bottom line is, as things stand now, to ssh in and place files in ./…/…/sites/default/images/ is the only method that puts a pic where it can be accessed by browser.
Will update the doc to that effect.
Thanks for the guidance!

1 Like

@htuck I knew I remembered a file upload. @brady.miller What’s going on with this module? I’ve not looked over source but…

Hmm. It looks promising, helpfully gives the path on the OpenEMR instances’ server where the file goes.
However, I uploaded a template to my demo with that path and it still gave the little ‘no image’ icon

Works for me. Could be permissions errors etc.

I must have mis-clicked somewhere- did it again just now and it worked for me too.
OOOHHHHH-Kay! this is very cool- will fix the docs and we’re off to the races!

This all works well. Something is missing though I can’t put my finger on.
Somehow this should be made easier for patient participation in office setting. Perhaps, pop out to a tablet or something.

Just discovered this when using the “Drop files here to upload” window to upload an image.

File is uploaded Despite what the error says!

On the other hand, “Browse” button doesn’t throw an error message and gives you a status report.

We’re at 5.0.2-2 on Ubuntu Server 18.04 using FF75.0 on Ubuntu 16.04 desktop(s)

I’ll look at while i’m poking around in v5.0.2… Will try to get in next patch.