Here is a patch against CVS to add an option where by each user's images are stored under a subdirectory.

This is helpful so that directories would not grow too large.

CommentFileSizeAuthor
#3 query.htm12.21 KBlakyljuk
image-userid.patch1.65 KBkbahey
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

lakyljuk’s picture

Hi, very nice patch, but I have following problem: I set everything up, import of images runs correctly, but at server I found all images in "user1" folder (which is what we want to), but also in folder "images" (which we don't want to). "images" is my default folder for storing uploaded images, "user1" is subfolder of folder "images" created automatically after applying a patch to image module.

Can this be corrected?

lakyljuk

kbahey’s picture

Is this is a test site? If so, can you delete all the images and then upload only two images, one from a user, one from another user.

Then in PHPMyAdmin enter the following SQL:

select * from files;

Then paste the output here.

lakyljuk’s picture

FileSize
12.21 KB

Sorry for attachment, but I wasnt able to paste it directly, it looked terrible (I am not experienced enough).
Another strange thing is, that when I DELETE images from gallery from admin section of drupal, images are deleted from folders "user1" and "user2", but not from folder "images". Don't know why.

Thanks for any help.

lakyljuk

lakyljuk’s picture

I forgot - when importing images I realized that appropriate folder userXX, where XX is id of user is created under "images" folder during process of importing, but before finishing it reports error - unable to write to folder. I looked into "images" folder and there is "userXX" folder created, but with atributes 740. I wasn't able to change it - permission denied. So I had to delete this folder, create manually, set atributes to 777 and then image import run correctly. It is my fault or bug?

Thanks for your time.

lakyljuk

kbahey’s picture

I see that the images are inserted correctly with a path component (subdirectory) that has the user name in it.

images/user2/user2_picture.jpg
images/user1/user1_picture.jpg

Yes, the permissions is an issue, but it is probably your setup. In the patch, I try to create the path with 0777.

Are you on a test machine where apache runs as a different user from the directories that you created Drupal in?

pfaocle’s picture

I've not tested the patch, but a +1 from me. Would be essential on large sites like demolicious.org, and a step towards personal image galleries.

lakyljuk’s picture

Hi.

Yes, permissions are probably my problem, on localhost is everything OK, but on my ISP's hosting is is creating subfolders according to userid, but with attributes 0740. I set this subfolder manually, attributes 0777 and then tried to import.

Yes, you are right, images are copied into folder images/user1/, but also into folder images/. And when I delete those images from within drupal, they are deleted from user1 folder ONLY and remain in folder images/. Don't tell me, it is normal behaviour. I think it has nothing to do with rights, since I set up attributes to 0777.

Thanks for reply

lakyljuk

kbahey’s picture

I have tested it and do not see any of the problems that you are seeing.

The user subdirectory is created, and the files are placed in it. The images are not anywhere else.

lakyljuk’s picture

Maybe it is because I am importing images via image_import module, which is using image module. So if image module is patched, image_import module stores images in userXX folder too. I don't know if it could be causing my problem or not. I supposed no, because image_import module only loads mass of files from folder and passes it to image module which makes resising, and placing images into appropriate folder and gallery.

lakyljuk

kbahey’s picture

I am not using image import at all, so can't say if it is the reason or not.

You can try it by disabling image import and testing image alone, and see what happens.

lakyljuk’s picture

Ok, you are right, after submitting image via image module only (not using image_import module) images are stored in correct folder userXX only. Doesn't matter, I can delete them manually, or patch image_import module maybe will be available.

lakyljuk

rvlong’s picture

Category: feature » support

Is this patch compatible with image.module,v 1.197 2006/05/02 06:54:35?

I get the following error when applying the patch:

bash-3.1$ patch -p0 patching file image.module
Hunk #1 FAILED at 84.
Hunk #2 FAILED at 731.
2 out of 2 hunks FAILED -- saving rejects to file image.module.rej

If not, is there another module out there that will allow me to manage user images in their own directory? I'm looking for a way to remove user images/content from the server after deleting an account.

I'm using Drupal 4.7.2.

Thanks,

jw867’s picture

Try this one patch: http://drupal.org/node/72685

Hetta’s picture

Status: Needs review » Closed (duplicate)

Not the current HEAD - possibly even 4.6?
Anyway, I'm marking this as a duplicate of http://drupal.org/node/72685