What is the process that will allow images stored on a NAS to be attached to nodes that can be rendered with image styles while allowing the file structure on the NAS to be traversed by a Drupal 7 module?

There is a shared folder on a NAS:


There is a virtual directory in IIS, pointing to the share:


Files on the share can be accessed through the website:


There is a custom Drupal 7 module that traverses the network share, creating nodes and attaching images on the share to those nodes as managed files.

The module can find image files on the share using only the UNC to the shared folder. This is problematic when attaching an image to a node as a managed file, since a UNC will not work. This must be done in the module with a URI going through the virtual directory:


So, what I am currently doing is converting the UNC to a URI, and adding an image to a node with that URI. This makes Drupal fail to actually find the file when it attempts to read the source (the URI through a virtual directory) while creating an image style, generating the error:

Unable to generate the derived image located at public://styles/my_style/public/nas/image.jpg

If I render the image without a style, it works with the source of /sites/default/files/nas/image.jpg. Other styled images not hosted on the NAS are created normally through the same process.

Is there a solution that doesn't use managed files, but will still allow image styles to be generated from images stored on the NAS?

Would I be able to change the public files directory to the NAS?

Any guidance would be greatly appreciated!

closed as off-topic by Patrick Kenny, Pierre.Vriens, Kevin, Shawn Conn, Neograph734 Oct 2 '17 at 10:51

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "Questions on programming, PHP, SQL, etc. that do not relate directly to Drupal are off-topic here, but can be asked on Stack Overflow." – Patrick Kenny, Pierre.Vriens, Kevin, Shawn Conn, Neograph734
If this question can be reworded to fit the rules in the help center, please edit the question.

  • I'm assuming this is because the file gets placed or mapped to the files directory without actually being recorded by Drupal? – Kevin Oct 1 '17 at 16:50
  • I don't think so? It shows up as linked to the node when editing, and so should be present in the "Manged Files" table. I can post the attaching code later, but the code works for non-NAS files. The managed file needs to be created with a public:// URI, which Drupal then apparently fails to evaluate to the virtual directory when grabbing the source for creating the styled image. – j.h. Oct 2 '17 at 3:35

Browse other questions tagged or ask your own question.