We're running a portfolio site for a photographer using EE, and he's got about 2 gigs worth of JPEGs on S3. CE Image is used to create two versions of each photo in his portfolio (thubmnail and web-sized).

The problem is, when CE Image does this, it stores a copy of the original source image, as well as the two processed versions, in the local directory specified by ce_image_remote_dir, even though the output is going to S3.

{exp:ce_img:pair src="{url-to-source-on-s3}" quality="85" max_width="980" bucket="s3-bucket-name" cache="yes" refresh="600"}

As a result, we end up with a full copy of everything the client has on S3 on the EE box; is there any way to prevent the storage of, and/or automatically purge the files in ce_image_remote_dir?


is there any way to prevent the storage of, and/or automatically purge the files in ce_image_remote_dir?

There is not a way to accomplish this with the default extension, but you could accomplish this with a custom one to meet your needs.

PHP has to have a local copy of the image in order to manipulate it. Additionally, it's much faster to check whether or not an image exists on the local server than to perform an http request to check if it exists on S3.

You're still getting the speed benefits of S3, as the manipulated image is being served from the CDN, as opposed to the local server's filesystem.

The S3 extension for CE Image is currently included for no additional charge with the purchase of CE Image. Since you are unhappy with how it works due to the large storage requirements of your site, you could always create a similar extension (using the same hooks) that syncs all of the file data with your local database, and then purges the source and manipulated images from the local server after uploading the later to S3.

  • Could we work around this issue by setting up a cron job that would replace all of the files in the local cache directory with empty files of the same name? That way CE Image can check to see if files exist locally, but we don't have to use up too much disk space. Feb 4 '13 at 18:08
  • @NickBenson I think the best way to handle this would be to record the names of the manipulated images that have already been written to S3 in a database table. Then you could query if the image has already been created or not. It would add a query to the page for each of the S3 images, but it would eliminate the storage space concerns. Feb 4 '13 at 21:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.