Closed (fixed)
Project:
ImageCache
Version:
6.x-2.x-dev
Component:
Miscellaneous
Priority:
Normal
Category:
Support request
Assigned:
Unassigned
Reporter:
Created:
12 Nov 2009 at 18:41 UTC
Updated:
22 Mar 2013 at 20:13 UTC
is there any way to delete the original image file after it has been manipulated. I have a site that manages 4 newspapers and it is quickly running out of space. Is it safe to manually delete the original?
Comments
Comment #1
adavis.co.uk commentedI'd also be very interested in an action to delete the original image for both space and security reasons. How about a preset called 'original' that acts on the original images?
Comment #2
arthursk commentedI second this, 20GB of space on a VPS is not enough when the original files are 2mb+
Deleting the originals seems to work as long as the imagecache is never flushed, and you never request an action on a file that no longer exists...
I think the ugly but safer solution for the time being would be running a batch on the originals to the minimum size you need and replacing them rather than deleting them...
EDIT:
Here's my attempt at resolving this issue VIA cron job.
I've compiled this script using a modified image resize class and recursive folder search found on the net.
Notes:
PHP Gurus feel free to tear it apart and speed it up! If you get any errors let me know.
Comment #3
sheba commentedYou can define "Maximum resolution for Images:" to some reasonable number. It will automatically resize images upon upload. It should save you lot of space. Also you can define image format (JPEG, GIF, PNG) which can be used.
Comment #4
1mundus commentedI usually delete originals manually and all of the created files in imagecache presets folders are displayed correctly. However, I'm annoyed by all of the warnings I get an therefore have two questions:
1. Is it possible to force imagecache (or filefield?) not to look for original file after preset file has been created?
2. If above is not possible, what would happen if I upload 1x1px images instead of originals? Would it change preset images? For example I visit "image_cache_preset/example.jpg" and it displays 500x400px image of a house. If I change original in files folder to 1x1 would my image_cache_preset/example.jpg be 500x400px or it would change to 1x1px?
Comment #5
drewish commentedThe best approach is what sheba suggest in #3. Use ImageField's scaling to reduce the size of the original down.
Comment #6
1mundus commentedI resize images before uploading so they are the same size as I want them to be. Since Drupal processes these images, they loose on quality, therefore I delete the images in imagecache preset folders and upload the "resized originals" in these folders.
The problem is that then I have two versions - one in .../files folder and the other in imagecache presets folders. I usually delete these in the files folder, since there would be more than 1gb of such files (thousands of images).
Therefore I'd like to know the logic behind imagecache module - does it recreate images using pictures from /files folder only when it detects that there are no corresponding images in imagecache preset folders or it recreates them on every page view when there is an image in /files folder?
Comment #8
playfulwolf commentedmaybe any Drupal based solution appeared?