Delete!

Phoca Gallery - image gallery extension
frx2000
Phoca Member
Phoca Member
Posts: 11
Joined: 11 Mar 2009, 15:48

Delete!

Post by frx2000 »

Why doesn´t Phoca delete the actual files? It only deletes db entrys and NOT the actual files. This means that your webspace will fill up VERY fast.
Last edited by caro84g on 13 Mar 2009, 09:56, edited 1 time in total.
Reason: changed title to non-capitals
User avatar
caro84g
Phoca Hero
Phoca Hero
Posts: 1369
Joined: 11 Feb 2008, 17:52
Location: Holland
Contact:

Re: Delete!

Post by caro84g »

Hi,

Phoca Gallery doesn't do anything with the originals, except checking if they're there and use them for creating thumbs.

With the setting 'clean thumbnails' in the Phoca Gallery Parameters (components > phoca gallery > control panel > [parameters] button), you can set Phoca to delete the thumbnails which aren't used anymore. By default this is set to 'no'.
See: https://www.phoca.cz/documents/2-phoca-g ... n_Settings

Regards, Carolien
Please ask your support questions in the forums and not via PM - I delete those PM's
Backup before you do any major change to your website (and test first)
frx2000
Phoca Member
Phoca Member
Posts: 11
Joined: 11 Mar 2009, 15:48

Re: Delete!

Post by frx2000 »

But if you do allow for uploads...you should allow for delete. Or else alot of "old files" will be filling up the webspace. I´m actually surprised there isn´t a function for this. This should absolutely be a feature for next version...a parameter for "Delete original file when deleted".
User avatar
caro84g
Phoca Hero
Phoca Hero
Posts: 1369
Joined: 11 Feb 2008, 17:52
Location: Holland
Contact:

Re: Delete!

Post by caro84g »

I like the concept, that for sure... But what do you do when an image is added to 2 different categories?

By the way: on the right hand side you see a feedback button. I think it has been requested by someone else, so you can vote for it. If that isn't the case, you can make a feature request.

Regards, Carolien
Please ask your support questions in the forums and not via PM - I delete those PM's
Backup before you do any major change to your website (and test first)
User avatar
Jan
Phoca Hero
Phoca Hero
Posts: 49297
Joined: 10 Nov 2007, 18:23
Location: Czech Republic
Contact:

Re: Delete!

Post by Jan »

Hi, the not deleting original images has a lot of reasons there.

E.g.:
- original images can be uploaded by other methods (ftp, media manager, etc). So Phoca Gallery cannot delete images which were not uploaded by the Phoca Gallery
- original image can be used for e.g. 5 entries in database (because there are two layers - database and file layer), so if you will delete it then it can be missed for other entries (e.g. for using it while downloading, recreating thumnails, rotating, etc.)
- if you work with images (image names in database), it can be very quickly and it is not time and performance consuming... if this will work with physical files on the server too, then the server can have problems with not enough memory and cpu. I have tested the function which will check the files (if they are not used anymore) but the searching physical files was so slow and took a lot of memory so such function was not implemented...

I think there are more possible problems (I don't remember them all :-( ) but they are surely described in this forum, so if you are interested, try to search this forum...

BTW: This works only for backend and not for frontend. In frontend original files will be deleted if user deletes the image (there is other system for accessing the files and some functions which are working in backend are not working here)

Jan
If you find Phoca extensions useful, please support the project
frx2000
Phoca Member
Phoca Member
Posts: 11
Joined: 11 Mar 2009, 15:48

Re: Delete!

Post by frx2000 »

Jan wrote:Hi, the not deleting original images has a lot of reasons there.

E.g.:
- original images can be uploaded by other methods (ftp, media manager, etc). So Phoca Gallery cannot delete images which were not uploaded by the Phoca Gallery
- original image can be used for e.g. 5 entries in database (because there are two layers - database and file layer), so if you will delete it then it can be missed for other entries (e.g. for using it while downloading, recreating thumnails, rotating, etc.)
- if you work with images (image names in database), it can be very quickly and it is not time and performance consuming... if this will work with physical files on the server too, then the server can have problems with not enough memory and cpu. I have tested the function which will check the files (if they are not used anymore) but the searching physical files was so slow and took a lot of memory so such function was not implemented...

I think there are more possible problems (I don't remember them all :-( ) but they are surely described in this forum, so if you are interested, try to search this forum...

BTW: This works only for backend and not for frontend. In frontend original files will be deleted if user deletes the image (there is other system for accessing the files and some functions which are working in backend are not working here)

Jan
I just have to ask some questions because i am curious. I´m not a Joomla developer so i don´t know about the inner workings of coding for Joomla. But i am an experienced PHP developer. So i can relate to the points you pointed out. But still have some questions. Maybe you can explain them to me (if you have the time) so i can understand more about Joomla.

"- original images can be uploaded by other methods (ftp, media manager, etc). So Phoca Gallery cannot delete images which were not uploaded by the Phoca Gallery"

Why? Because of file and directory rights? Can´t u use chmod() to fix this issue?

"- original image can be used for e.g. 5 entries in database (because there are two layers - database and file layer), so if you will delete it then it can be missed for other entries (e.g. for using it while downloading, recreating thumnails, rotating, etc.)"

I guess you mean that the data has relations...can´t u use transactions for this? If something fails...rollback.

"if you work with images (image names in database), it can be very quickly and it is not time and performance consuming... if this will work with physical files on the server too, then the server can have problems with not enough memory and cpu. I have tested the function which will check the files (if they are not used anymore) but the searching physical files was so slow and took a lot of memory so such function was not implemented..."

A couple of years ago a wrote a file/image library where you can upload, view, edit and delete the items. It works ONLY in file layer...no DB used. And it has worked pretty good but i don´t know any limits of the system (intended for small business owners as a webbased harddrive).

The problem with not having a "Delete image" function is pretty serious. My clients are pretty unexperienced computer users. I installed Joomla and Phoca and has taught them how to work with it. The problem is that the webservers harddrive fills up pretty fast. And how do i clean up old files? It´s hours and hours of work stepping through each file and see what files are used and not used. It´s a pretty big problem.

Maybe you can add a new page to Phoca named "Clean up". Then do the filechecking file_exists() function there?

Maybe you can also add it to the frontpage:
if (!file_exists($name_from_db)) then
displayNAImage();
User avatar
Jan
Phoca Hero
Phoca Hero
Posts: 49297
Joined: 10 Nov 2007, 18:23
Location: Czech Republic
Contact:

Re: Delete!

Post by Jan »

Hi,
"Why? Because of file and directory rights? Can´t u use chmod() to fix this issue?"
This is not technical problem, Phoca Gallery has not created such files so it should not have a function to automatically delete files which it didn't create.


Maybe you can add a new page to Phoca named "Clean up" Yes, I have thougt about it...

BTW try to enable the parameter (clean thumbnail files) which check if the thumbnail is used or not, this will slow your system and e.g. is not usable if you have e.g. 1000 images but there are people who have e.g. 5000 images in Phoca Gallery. The function check file vs. database item. If there is not item in database, it will delete the thumbnails. Very slow if it should check all the files on your server :-( And it is only small variant of function which was there in first two versions of Phoca Gallery (this function checked all the files) After problems on webhosting servers (on some servers Phoca Gallery component was forbidden) the function which automatically looked for unused images was disabled. :-(

But of course, if there will be some better way, how to handle the files, I would like to implement such function because it is right, that looking for old files is not good solution...
If you find Phoca extensions useful, please support the project
Post Reply