External Image checking

External Image checking

  
 Hi Guys, I have an inquiry regarding the checking whether an image exists.

We have used the File_Exists action from the built-in references, but the action always returns false even when an image exists from the given path.  Any ideas?

I have used the path from the virtual directory I have created.

Regards,
Lawrence
Lawrence -

What is the source of the image? Where is it being stored? Is it an image that you have as part of your eSpace?

J.Ja

 The image is stored in a Development Server, I created a virtual directory pointing to the Path of the Image.



Lawrence
Hi Lawrence,

File_Exists requires that the IIS user of your application has filesystem privileges on the folder. Did you set them correctly?
There are some topics on the forum about access to the filesystem.

Regards,
João Rosado
 I have already set the Permissions of the IIS_IUSRS Group to Full Control, here is a screenshot.


 But still no changes, the file is not found.

I have also another screenshot if this is related to this issue regarding the  FileSystems reference.



  Regards,

Lawrence
Lawrence -

The app pool doesn't run under "IIS_IUSRS", that's a common mistake because it used to work that way.

This article tells you what you need to know about app pool identity:
https://www.iis.net/learn/manage/configuring-security/application-pool-identities

J.Ja
  I have tried the procedure in the link you have posted Justin but the Action still returns false even if the image is available.

 Lawrence
Have you gone through the debugger and verified that the path going into "File_Exists" is correct? Can you post the path going into the debugger? There may be something missing or incorrect with it.

J.Ja


Here is the path that is used for the File_Exists action :
 "/EIS_Member_Image/1057486.jpg"

the /EIS_Member_Image/ is the virtual directory from the server which points to \\devdb\IMAGESTORAGE\.
Laurence -

That path is no good. It needs a path for the file system to be passed to File_Exists.

Also, if the location is on a network share or a UNC path (like that one is for the physical location), you need to use the NetworkFileSystem extension, not FileSystem (which, as far as I can tell, has been made obsolete by NetworkFileSystem).

J.Ja
   
 I am now using the NetworkFileSystem Extension, for the File_Exists Action, the ff. parameters are added : 
 - domain
 - username
 - password
- errormessage

i am still using "/EIS_Member_Image/1057486.jpg" for the Path parameter, 
 what  should I input in the Domain? 
The Image is displayed, I am only using the File_Exists Action to check if a specific member has a picture, if none, I will display a Picture for No Image displayed.

Regards,
Lawrence
Lawrence -

The "Domain" should be the Active Directory domain that the destination computer is joined to, or that computer name. Make sure to use a username/password for a user in that domain/computer with access to the files.

Your path is still bad, you need to be using the UNC patch (ie: \\devdb\IMAGESTORAGE\file.jpg or whatever). I'd suggest you use the function (sorry, forget it's name... probably under HTTPRequestHandler) to turn the virtual path of "/EIS_Member_Image/1057486.jpg" into the UNC path, or try hardcoding the right UNC path to a file in just to test.

J.Ja

Justin

the UNC Path works but the reason I am using the path for virtual directory is because our application is deployed to 2 servers.. but the image folder is located only on server a. I have created a virtual directory in server b pointing to thr image folder in server A.

Lawrence
Lawrence -

You cannot pass the virtual path to the File_Exists command. It does not understand it. You *must* use the proper command to translate the virtual path into a physical path.

You've proven that the physical (UNC) path works. The only thing in your way is that you are still trying to pass the virtual path.

J.Ja

Justin
 
 my HTTPRequestHandler only has 3 actions 
 - GetEntryURL
 - GetRawURL
-  RunJavascript

There is no function to convert the Virtual Path to Physical Path.

 i looked for the HTTPRequestHandler extension in the website but the extension is not available to download, isn't there a latest update for this extension?

   Lawrence

Lawrence -

That's because you haven't added the reference to the right action it in your application. Go to Add/Remove References, select "HttpRequestHandler" on the left... make sure "Show All" is in the drop down in the top right.

Either way, I don't see the right action there anyways.

You're already going through the effort of having to add a virtual path to the server, I think your best bet is to put the first part of the UNC path into a site property, concatenate with the image-specific parts of the path like file name at run time, and pass that to File_Exists or anything else you need to do.

J.Ja

  Justin,

First of all I want to say thanks for being patient in helping me with this issue.  However, there is something I need to clarify with you.
 The reason why I am using the Virtual Directory Path for the Image is because Browsers like (Chrome, Firefox) have security issues in displaying the Image coming from the UNC Path (\\devdb\IMAGESTORAGE\)

I have already asked around about that issue and was able to resolve by using the Virtual Path in this link :

http://www.outsystems.com/forums/discussion/11436/image-display-issue-in-firefox-and-chrome/

  Lawrence

 
Lawrence - glad you solved it. I wish I had known the context a bit better, it seems like you were going in the wrong direction (using File_Exists) if your goal was to display it in the browser.

J.Ja