<![CDATA[ Gallery: How to change image file names in cache? - My Forums]]> https://forums.modx.com/thread/?thread=91790 <![CDATA[Re: Gallery: How to change image file names in cache?]]> https://forums.modx.com/thread/91790/gallery-how-to-change-image-file-names-in-cache#dis-post-550109 My version of MODX is MODX Revo 2.5.5., Gallery version - 1.7.0 (but I guess you can try it with earlier versions...)

You should make some changes in files galalbum (core/components/gallery/model/gallery/galalbum.class.php) and, for Multi-Upload, in ajaxupload too (core/components/gallery/processors/mgr/item/ajaxupload.php).

In galalbum.class.php:
Find public function uploadItem. Change $shortName, it should be something like this:
$shortName = $item->get('id').'__'.basename($name);

So you will get files names like "123__SomeFileName.jpg", where the first number is ID of the file (I prefer not to erase it because you can have files with similar names in the same folder, and this will prevent conflicts), "SomeFileName.jpg" - original filename.

This works only for single file upload (and breaks Multi-Upload).

And now Multi-Upload. in galalbum.class.php change this:
$target = fopen($this->getPath(false).$shortName, "w");

to this:
$target = fopen($this->getPath(true).$shortName, "w");


And in ajaxupload.php:
$filename = $item->get('id').'.'.$extension;

change to this:
$filename = $filenm;


And one more thing. I need to mention that I use some additional methods to cache thumbnails and store them, so I don't know if my solution for filenames would work smoothly without this caching... I took code for caching here: https://www.createit.ru/blog/modx/2012/caching-preview-images-in-gallery Sorry, this article is not in english( I hope online translation would work fine.]]>
tenjou_utena Apr 14, 2017, 04:38 PM https://forums.modx.com/thread/91790/gallery-how-to-change-image-file-names-in-cache#dis-post-550109
<![CDATA[Gallery: How to change image file names in cache?]]> https://forums.modx.com/thread/91790/gallery-how-to-change-image-file-names-in-cache#dis-post-501518
we use the gallery plugin version 1.6.2-pl with modx revo 2.2.14-pl.

the gallery plugin creates cache folders with images inside like: 11.jpg, 33.jpg ...

Is there a way to keep the original image filenames and not to rename the image names to numbers in the cache folders?

regards
stefan]]>
bagstage Jun 26, 2014, 05:36 AM https://forums.modx.com/thread/91790/gallery-how-to-change-image-file-names-in-cache#dis-post-501518