splittingred / phpThumbOf

A secure phpthumb output filter for MODx Revolution
http://rtfm.modx.com/display/addon/phpthumbof/
23 stars 17 forks source link

Reason that resource ID is appended in getCacheFilename()? #44

Open j-craig opened 12 years ago

j-craig commented 12 years ago

On a few sites I'm using phpthumbof to resize/crop banner images supplied by the user. In this case, when the same image is used on several different pages, phpthumbof is generating different images for each different page. I can see from the source now that it is appending the resource ID to the end of the filename in phpthumbof.class.php, line 306.

In my eyes, I don't see the need to append the ID...but perhaps I am not thinking of a proper use case where this would be handy? For me it just adds extra copies of images, extra time to generate pages when the cache is cleared, and lessens the ability of the users browser to cache repeated images.

Also, thanks for your hard work! This is a very useful MODX addon.

goldsky commented 11 years ago

I also have a problem related with this issue.

$this->cacheFilename .= '.'.md5(serialize($this->options)).$this->modx->resource->get('id');

when I tried to use phpThumbOf in an AJAX process. There is no resource object when it's called inside the AJAX processor, so you can guess, FATAL ERROR occured.

If I commented out this line 306 of phpthumbof.class.php, it worked.

goldsky commented 11 years ago

I ended up just by editing it to:

$this->cacheFilename .= '.'.md5(serialize($this->options));