Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Images being cached twice #49

Open
studiorepublic opened this issue Jun 20, 2017 · 8 comments
Open

Images being cached twice #49

studiorepublic opened this issue Jun 20, 2017 · 8 comments

Comments

@studiorepublic
Copy link

We are using pThumb to grab remote images and create thumbnails. We use S3 to store the thumbnails and this works fine, but images are also being stored in assets/components/phpthumbof/cache.

Is this a bug or something I've done wrong?

@ysanmiguel
Copy link

ysanmiguel commented Nov 17, 2017

Mate, did you solved this problem?I'm having the same annoying situation.
Because images files are on AmazonS3, cache files are there too, I'm using cloudFront to download the images via cdn so I don't need any image in the server at all..

I understand the idea of the remote-images folder, if you need speedup the images loading, but why do I need to store images somewhere else if all the images are going back into the server?
In that case it's not better just leave the image in the server and don't waste time configuring something else to pt your images there?

I think the only good reason to store local (tiny) images should be to speed up the Media Browser, because it's taking ages displaying the thumbnails. It's taking the thumbnails from the original BIG images in S3 and resizing it before display it.

Everything works great but I think this needs a small improvements like a setting to use a cdn address to call the images, so using the AmazonS3 bucket set on pthumb.s3_output give the option to upload the images there but with a cdn will be necessary cal the image from somewhere else.

For now I think is important to stop the creation of local cache and remote-images, if somebody did it please help me, thank you!

@labr1005
Copy link

labr1005 commented Nov 19, 2017

As far as I can see the current order of process (for remote images) is like this:

  1. Is it a remote image?
  2. Is the remote image existing in assets/components/phpthumbof/cache/remote-images/?
  3. No: download it. Yes: skip.
  4. Is the (now local) image already processed as defined in the pThumb call's options and existing in assets/components/phpthumbof/cache/?
  5. No: process it (and upload to remote, if defined). Yes: skip.

So pThumb needs these local versions of the image to check if it "has already done its work". There's no record in the database or something similar that could be checked.

@ysanmiguel
Copy link

If pThumb is going to have all the cache and original files locally, what is the point to move it somewhere else?

I think if we (as users) needs to use a external place to move the images is because:

  1. space: so many images on high quality, the server is getting full.
  2. speed: if I move it to S3 I can use the cdn to request the images twice as fast.

This is possible creating 2 buckets, one for the images, one for the cache files including the cdn address.

Here is what I think is completely unnecessary:

  1. Why it's downloading and making a local copy of the original files? If I move it abroad for a reason!
  2. Why it's downloading the cache files, if the one that we need to use and display are the ones on the cloud not the local ones!
    3.And one of the most senseless is why is retrieving the thumbnails (ModX Media Browser) from the cloud original files if should exist a local copy? If you have 30 or 50 images in a folder that is not an insane ammount that takes so long. Even once you see it if you move to another folder then open the folder again it didn't save anything and retrieve the images again from zero, taking so long time again.

It should:

  1. Don't for any reason download original files!
  2. Use the cache files on the S3 only, don't download anything.
  3. download or create a tiny version of the thumbnails in the ModX Media Browser, the big picture preview can be created on request, Save this thumbnails and use it every time that the user needs to see the Media Browser to upload or pick any picture.
  4. If pThumb needs these local versions of the image to check if it "has already done its work", why not compare date/size instead of download the whole file?
  5. a setting to replace the S3 file url and change it for a https://cdn.url.com, this to make easier the configuration and avoid creating 2 Media Sources to make this possible.

@labr1005
Copy link

I agree. I only said, how it is.

@ysanmiguel
Copy link

I think the project is amazing, just need very important improvements on S3.
For the next version I hope!

@ysanmiguel
Copy link

soon :P

@jonleverrier
Copy link

+1

@travisbotello
Copy link

This is specifically annoying because the folders assets/components/phpthumbof/cache/remote-images/* don't get cleared although pthumb.clean_level is set to 1. Already ran out of disk space multiple times because of this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants