Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
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.
Comment | File | Size | Author |
---|---|---|---|
#3 | query.htm | 12.21 KB | lakyljuk |
image-userid.patch | 1.65 KB | kbahey | |
Comments
Comment #1
lakyljuk CreditAttribution: lakyljuk commentedHi, 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
Comment #2
kbahey CreditAttribution: kbahey commentedIs 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.
Comment #3
lakyljuk CreditAttribution: lakyljuk commentedSorry 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
Comment #4
lakyljuk CreditAttribution: lakyljuk commentedI 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
Comment #5
kbahey CreditAttribution: kbahey commentedI 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?
Comment #6
pfaocleI'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.
Comment #7
lakyljuk CreditAttribution: lakyljuk commentedHi.
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
Comment #8
kbahey CreditAttribution: kbahey commentedI 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.
Comment #9
lakyljuk CreditAttribution: lakyljuk commentedMaybe 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
Comment #10
kbahey CreditAttribution: kbahey commentedI 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.
Comment #11
lakyljuk CreditAttribution: lakyljuk commentedOk, 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
Comment #12
rvlong CreditAttribution: rvlong commentedIs 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,
Comment #13
jw867 CreditAttribution: jw867 commentedTry this one patch: http://drupal.org/node/72685
Comment #14
Hetta CreditAttribution: Hetta commentedNot the current HEAD - possibly even 4.6?
Anyway, I'm marking this as a duplicate of http://drupal.org/node/72685