Greetings,
I'd like to have the images path correspond to each user's name but I wasn't sure how to add it to the path.

This is my current Node images path:
D:\www\public_html\susdfiles\node_imgs

Do I add %uid to the end like:
D:\www\public_html\susdfiles\node_imgs\%username\%uid

I tried it like this to test:
D:\www\public_html\susdfiles\node_imgs\%username

but all I got was another directory named %username. When I posted as admin a new directory with admin wasn't created.

Thank you!
Lsabug

Comments

stefano73’s picture

Status: Active » Fixed

Fixed in the latest CVS commit.

lias’s picture

I noticed that the 4.7 version was updated but where is the cvs version for 5?
Thanks.
Lsabug

lias’s picture

The cvs version can be found here:

http://cvs.drupal.org/viewcvs/*checkout*/drupal/contributions/modules/no...

Thank you.
Lsabug

lias’s picture

I'm using the cvs version here:

http://cvs.drupal.org/viewcvs/drupal/contributions/modules/node_images/n...

And I get the following error message:

The directory does not exist.
The directory /home/iphis/files/node_imgs/admin has been created.

when I try to add the following to my files path for node images:
/home/domain/files/node_imgs/%username

It did in fact create the directory for the user I was logged in as (admin) but the file path won't stick after submitting it.

Lsabug

stefano73’s picture

Do you write the path like this?

files/node_imgs/%username

lias’s picture

No, I added just like this:

/home/domain/files/node_imgs/%username

because my files system is above the root for private file directory.

When I add like this: files/node_imgs/%username

it gives me directory can't be found.

lias’s picture

Title: Correct way to add variable %username to Node images path? » Adding variable %username or %uid to private file path doesn't work right
Status: Fixed » Active

I'm still having a problem using node images with my drupal private file path set above the root.

this is the error I get after adding the file path:

The directory does not exist.

but then it node image says this:

The directory /home/domain/files/node_imgs/1 has been created.

and it's true because the directory for user one, admin, was created based on this file path:

/home/domain/files/node_imgs/%uid

It does create a directory for user 1 when I'm trying to configure the node images settings in admin. But it keeps giving me the error that the file directory doesn't exist.

In the logs it says:

The directory /home/domain is not writable, because it does not have the correct permissions set.
and
The directory /home is not writable, because it does not have the correct permissions set.

The error doesn't even mention the files/node_imgs/ part of the path.

So how can it create the directory and give me these error messages? It doesn't retain the setting after I submit either. I've got the node_imgs directory chmod 777 and the other modules I've enabled that use uploading and images work fine.

Suggestion?

lias’s picture

Title: Adding variable %username or %uid to private file path doesn't work right » On Windows/Apache2 install files path works to create user dir until you upload an image
Priority: Normal » Critical

Because I've not come across a solution to the node images path issue, I decided to try node images on a brand new drupal 5 install on Windows and Apache2 since I was having problems on a Linux/Apache install.

This time I entered this as the path (drupal private file system above root):

D:\www\public_html\classfiles\%username

and it did create the admin folder within the classfiles directory. I also tried a user and it did create that directory as well and gave me a confirmation screen of:

The directory D:\www\public_html\classfiles\lsabug has been created.

The problem is, when I go to upload a file it says it's been uploaded but there's only a text link and a broken image notice on the node. The path is also totally messed up.

Not Found

The requested URL /system/files/D:\www\public_html\classfiles\lsabug/34fc5235508ef6d04b8cc55a0568bd39.jpg was not found on this server.

The other strange thing is that when I go to edit my node images file it does list the path according to where it should be correctly except for the forward slash after the username and it's inaccessible from the node I created:

D:\www\public_html\classfiles\lsabug/72af24d1d67e1b8e47ad807ea22e34da.jpg

I just tried uploading a file to see if attaching a file worked and while I was able to attach and download the file according to the following path it's not the correct path but it works which boggles my mind (files directory in the path should be called classfiles yest the file was uploaded to the classfiles directory - i checked-- and opens when I click on it):

http://www.domain.com/system/files/Kits+Catalog.xls

Unfortunately, I don't know what to look for in the node images file to figure out how this path is getting created. But this is where it seems to be breaking down. Is it upload.module that's messing up things? Or drupal relative / absolute file paths?

Lsabug

lias’s picture

sorry, I seem to have changed my original issue about paths to this one. I can't figure out how to change it back.
lsabug

lias’s picture

Just tried out the latest version from 250107 and it's almost working on the windows install. This time the path that I entered in the node images setting page stuck, it created the directory plus it uploaded the file to the correct user folder. Terrific!

But, the drupal private file system appends the path for viewing with

/system/files/ and there's another forward slash in front of the file name, see below.

/system/files/D:\www\public_html\classfiles\lsabug/72af24d1d67e1b8e47ad807ea22e34da.jpg

I'm going to test the latest version on my apache drupal install and see what happens. I'm hoping that the paths will work since the forwards slashes should work for linux.

thanks for the update.
Lsabug

lias’s picture

Well, just tried on a linux box and this time I still can't make the file stick in the node images settings and in my logs this is what I get for the path of /home/domain/files/node_imgs/%username:

Type file system
Date Friday, January 26, 2007 - 2:44pm
User admin
Location http://domain.com/admin/settings/node_images
Referrer http://domain.com/admin/settings/node_images
Message The directory /home/domain is not writable, because it does not have the correct permissions set.
Severity error

Why is it trying to write to /home/domain instead of /home/domain/files/node_imgs ? I've got the files and subdirectories folders all set at 777 for testing but I''m getting these weird errors for directories at /home/ and /home/domain and sometimes /home/domain/files .

**bump please***
Any ideas, someone else besides me would be appreciated?

lias’s picture

Helloooooooo,

Just wondering if the latest version fixes the path issue?

stefano73’s picture

Do you have a test site so I can see what's wrong?

lias’s picture

Hi stephano73,

I just have my production site at the moment on a linux/apache based server. Would it be enough to give you adminsiter node images permission?

It's so weird because I get the following error:

The directory does not exist.
The directory /home/domain/files/admin has been created.

But then it goes and creates the first user/admin directory but the file directory doesn't "stick" for the user images path. Is there somewhere in the module that I could hardcode it? I'm thinking maybe that will do it?

Thank you for the reply, this has been most frustrating especially since it's happened on new installs on both windows and linux apache. Uploading images via the image module work so it's really perplexing.

stefano73’s picture

Contact me in private by my contact form http://drupal.org/user/7410/contact

lias’s picture

Thanks for the quick response stefano73, I'm going to use the current linux/apache production site and create a development version this evening. I will contact you with the information via your contact form once that's up, hopefully tonight as well. I do appreciate your willingness to take a look!

Quick update: I was able to get node images functioning on the windows box with the exception of the correct path to view. The file path where the users directory for node images was correctly created but when it's time to display there's a problem still with the forward slash "/" between the username and the filename. For my windows 2003 box it needs the back slash to correctly display the image. See path:

D:\www\public_html\classfiles\node_imgs\JD/susd_plc.png

I thought I found where it was inserted in the module but I was wrong and ended up breaking the site so had to revert to the original. Where can I change this forward slash? Is it in the module file or maybe in js file?

Lsabug

stefano73’s picture

Status: Active » Closed (fixed)