Can not view scanned document

bdwderm wrote on Wednesday, June 18, 2008:

Today I used a paper template which was then scanned but can’t be viewed from within OEMR (it shows a broken graphic image icon).

The filed was scanned as a PDF and I verified that it was indeed uploaded (it’s within the emr “documents” directory) but was evidently converted to a jpeg (no problem with that).

When I view the image location I see: http://192.168.0.101/openemr/documents/109/encounters/609_1.jpg

If I enter this url into another tab I get: Forbidden. You don’t have permission to access openemr/documents/109/encounters/609_1.jpg on this server.

Is this a permission issue that may not configured properly or am I doing something wrong?

Brent

ternary wrote on Sunday, July 13, 2008:

Hi,
I’m having similar issues, except my location does not show slashes, although my document image is there.

More than likely you have permission issues. Your either Apache or PHP’s built in user (that executes web pages) doesn’t have rights to show the picture in that folder.

Warning however. If you open another tab or new browser window, that session might not have access to any openEMR file because the webserver might see that other Tab or browser window as a distinct and different user (who hasn’t logged in yet).

Let me know how/if you figured it out.

FYI. I’m not sure how to properly set up my globals.php file. The documentation I read is *nix-centric and when I messed with teh line that says:

$webserver_root

If I mess with it enough I can go from an error that says

"The requested document is not present at the expected location on the filesystem or there are not sufficient permissions to access it. C:xampphtdocsopenemrdocuments/1/IMG00089.jpg"

to

a PHP smarty error that complains about not finding critical include files to run the PHP script.

I am using the latest (as of today) XAMPP, OpenEMR (both windows versions) and used a combination of “INSTALL” text file in the OpenEMR distribution as well as Dr. Bowen’s Wiki page on how he installed OpenEMR.

I was successful in uploading images on that local machine and uploading files to the webserver from a remote machine with similar errors from the local and remote machine when trying to view the files. Yes. I know C:\\ on the remote machine is referencing the server’s local filesystem :slight_smile:

ternary wrote on Friday, July 18, 2008:

Update: I notice that the file path is being stored literally as "C:xampphtdocsopenemrdocuments/1/IMG00089.jpg" in the mysql openemr documents table in the URL column. If I edit the value directly in the column to "C:xampp/htdocs/openemr/documents/1/IMG00089.jpg" (i.e. include the slashes) then it comes up correctly.

There is obviously an issue with the upload mechanism that does an INSERT into the database. Unfortunately I don’t have a clue where to look for the sql statement or stored procedure (I’m used to visual studio.net’s debugging).

I think the original poster’s problem is a permissions issue, rather than the same issue I"m having.

drbowen wrote on Friday, July 18, 2008:

This is a problem of the slashes being stripped from your path.  Slashes are normally stripped to prevent illicit insertions into the database.  Your set up is causing too many slashes to be removed.

Try checking php.ini and turning off "Magic_quotes".  Usually php.ini will be in "C:xampp/php/php.ini".

Sam Bowen, MD

ternary wrote on Saturday, July 19, 2008:

Thanks, Doc! It worked.

My (test) setup. Old Sony VAIO Laptop. Windows XP Home SP3. Latest downloadable XAMPP (remember, this is a test machine), OpenEMR as of today (not CVS’d versions). I didn’t install SQL Ledger so some of my reports don’t work.

1. I started xampp, went to http://localhost and got the default xampp page that show you some demo scripts you can try.
2. I Clicked on php.ini and saw that the php.ini that xampp was running was in c:\\xampp\apache\bin\php.ini (there are several php.ini in xampp that are strewn about in different directories and from what I can tell only 1 is used).
3. I fired up the aforementioned php.ini in Wordpad and noted there was one set of magic quotes (GET/POST/Cookie Data)that was set to “On” which I reset to Off and saved the file. Do not do this using Notepad. You must use a ‘real’ text editor. There were 2 other Magic_Quotes lines which were already set to Off that I didn’t touch.
4. Then via the xampp control panel I stopped and restarted Apache.
5. Then I went to my remote computer (another computer on this network) and uploaded a freshly scanned .pdf to a patient folder. This time when the upload was completed, in the text it showed the slashes for the path on the “server” and I was able to immediately view the pdf.

I haven’t tried uploading a file to openEMR from the server machine yet…

drbowen wrote on Monday, July 21, 2008:

This should work from any machine including the server.

The problem with editors has to do with formatting.  Most Windows editors are not WYSIWYG.  For instance most Windows documents end with "^M".  This is very easy to see in the Unix world.  We can always tell when a document was created on a Windows machine. 

The tools we are using Apache, PHP, MySQL were created in the Unix world and were subsequently ported to Windows.  Most of the time there is very little difference.  One of the exceptions are these end of line characters.  To get around this it is important to use an editor that does not do extra formatting.  "Edit" is one of these.

This is also the reason that in "globals.php"  You have to use a case sensitive string and can use the Unix style  "/" in the path instead of the Windows style"".

Sam Bowen, MD