Trying out image and image_assist I uploaded some test images that I had no intention of leaving published.

I was then able to delete the content from Drupal but the images remain on the web server.

All my attempts to delete them through FTP or even through our host control panel result in errors informing that I don't have permission or that the files aren't there.

How do I delete these things?

Comments

hbryan’s picture

Oh, these images are in /files/images/temp on the server.

hbryan’s picture

OK, I found this:
http://drupal.org/node/97284

There is described a couple of complicated solutions that I don't understand.

Is there a solution for a non-expert?

hbryan’s picture

Seriously, I need to delete these files. Why on earth would anyone make a module that takes away your file permissions?

Will it help if I delete my database? Would that give me the proper permissions to delete my files?

I realize now that I was obviouly very, very deluded when I somehow convinced myself that one does not need to be an expert in PHP to work with Drupal, but it is done now. I am stuck with it and I need to make it work.

At least for a while, anyways.

PLEASE HELP. PLEASE, PLEASE, PLEASE.

sepeck’s picture

No one went out and took away your file permissions.

The images were saved under the web server user account because that is the account that actually wrote them to the files dir on your server when you uploaded them.. Contact you host to get the directories/images chmod'd to your account.

-Steven Peck
---------
Test site, always start with a test site.
Drupal Best Practices Guide -|- Black Mountain

-Steven Peck
---------
Test site, always start with a test site.
Drupal Best Practices Guide

hbryan’s picture

Obviously I can contact our web host to clean up the mess left by the image module.

Also obvious, that is far from desirable as a permanent solution.

Why would someone make a module that leaves behind a mess like this?

sepeck’s picture

Because they thought it would be fun to listen to people in the forums accuse them of nefarious things and question their motives in writing and contributing free software. sigh

If certain directories (/files, /files/pictures, etc) do not exist when you install Drupal, Drupal will attempt to create them automatically in order to help you. If it does this because the directories did not exist then it will do so under the account that is running the apache web server process and NOT your account.

This has more to do with your web setup. Apache runs under a certain account which gives it certain privileges to anything that account does. You log onto your account with your account which give you certain rights. When you upload an image/files those files are handled by the account running the web serve, not yours. So when they are saved, if your account doesn't have the rights the file system/directory they are saved in, then your account will not have access.

Because of the way your host provider has setup their web hosting environment, you may have to call them and have them chmod the permission to that files/directory that was created under these conditions.

This is not a mess, this is merely one example among many of the wide variety of differing host setups that you can encounter under which Drupal does work. I and thousands of people have never had this problem with our host setups, you and many others have. No one has done anything wrong, it's just something that happens in some configurations.

-Steven Peck
---------
Test site, always start with a test site.
Drupal Best Practices Guide -|- Black Mountain

-Steven Peck
---------
Test site, always start with a test site.
Drupal Best Practices Guide

hbryan’s picture

I did create those directories under my account.

It's simply the images in the temp folder that drupal will not allow me to delete.

I was logged in, yes, as me, when I uploaded test images to test the image module. I removed the images, again yes, logged in, again yes, as me.

However, drupal has left multiple undeletable copies in multiple sizes of each and every single deleted image in the "temp" folder.

digitalfrontiersmedia’s picture

Steve is somewhat correct, however as a newbie I don't think the Drupal installation documentation was very clear on how to setup the folders initially to avoid such problems. I, too, have been plagued by the permissions problems you're reporting. The images are deleted from your database but the files still show in the tmp directory? The image module seems to leave the clean up to your host's cron utility at least that's what seemed to be happening with me. Have you set up your host's cron utility correctly?

My problem was that cron apparently had different permissions than Drupal and can't delete those particular files created by Drupal so my files still wouldn't go away. My solution was installing the Drupal module "Poor Man's Cron" which handles cron utilities but directly from Drupal, hence the deletion commands come from Drupal and are executed without permission problems.

However, it's not as flexible as cron.

--
Web: http://digitalfrontiersmedia.com
Cell: 941.773.2036
Phone: 941.677.DFM1 ( 941.677.3361 )
Skype: DigitalFrontiersMedia
Twitter: DigitalFrontier
--

hbryan’s picture

"I don't think the Drupal installation documentation was very clear on how to setup the folders initially to avoid such problems."

Is it even mentioned in documentation?

"Have you set up your host's cron utility correctly?"

I followed the link in admin/settings under "chron jobs" to a drupal page "configuring cron jobs" but I didn't read anything that sounded like it would be useful to us. You say it will delete these rogue images?

sepeck’s picture

It's not a module problem. It's not a common problem. It's specific to a certain type of host configuration not the module itself. It is a server configuration issue. I've never had this problem.

No one who has had this issue contributed their solution back in the form of documentation to the Troubleshooting FAQ. Please feel free to.

If you feel that the image module documentation could be improved, then please write what you would have wished for and file an issue with the image module project.

This is not to dismiss your complaints, this is to mention how you can go about improving and contributing to the open source software you are using.

-Steven Peck
---------
Test site, always start with a test site.
Drupal Best Practices Guide -|- Black Mountain

-Steven Peck
---------
Test site, always start with a test site.
Drupal Best Practices Guide

hbryan’s picture

So how do I install this module on a new site in such a way that I actually have the file permissions that I should have?

ica’s picture

Create a Drupal page (ie. copy and paste this into a Drupal page, set input format to "PHP", and save the page).
copy and paste code snipped into a that page, set input format to "PHP" (core PHP filter module should be activated to do this)
and save the page

<?php
`chmod -R a+w directory/subdirectory`;
?>

whatever the folder names on your server i.e

<?php
`chmod -R a+w sites/default/files/images`;
`chmod -R a+w sites/default/files/imagecache/preview`;
`chmod -R a+w sites/default/files/imagecache/large`;
?>

note:
- do not put this page as published so no one else can execute the chmod snipped
- when you submit this page it will change the chmod permission on your server

than FTP to your files directory you will be able to delete all the files that previously could not do so

that is a quick fix until a proper file image management module available that also delete the physical files when they are deleted from the nodes

- I noticed this issue now but it is 2 years old, hope the submitter found a solution nevertheless if anyone end up having the same problem and search find this issue this the snippet might help

blueroseowr’s picture

This sounded like a great idea, but unfortunately I got a message saying shell_exec() has been disabled for security reasons. I guess it is back to calling my web host.