× Here you can get community support related to ReDJ.

part of a file is the recuring matching pattern

More
9 years 9 months ago #2853 by Akuna
I use phocagallery which automatically creates thumbs for each picture according to a specific pattern.
For exemple, if a picture is called IMGxxx.jpg, phocagallery will automatically create:
phoca_thumb_s_IMGxxx.jpg
phoca_thumb_m_IMGxxx.jpg
phoca_thumb_m2_IMGxxx.jpg
phoca_thumb_m3_IMGxxx.jpg
phoca_thumb_l_IMGxxx.jpg
etc.

Since IMGxxx.jpg is not very descriptive, I renamed all such cryptic names with more human readable names, which I now need to redirect. But rather than redirect each picture + its automatically created thumbs, for example :
From: IMGxxx.jpg To: new-human-readable-name.jpg
From: phoca_thumb_s_IMGxxx.jpg To: phoca_thumb_s_new-human-readable-name.jpg
From: phoca_thumb_m_IMGxxx.jpg To: phoca_thumb_m_new-human-readable-name.jpg
From: phoca_thumb_m2_IMGxxx.jpg To: phoca_thumb_m2_new-human-readable-name.jpg
From: phoca_thumb_m3_IMGxxx.jpg To: phoca_thumb_m3_new-human-readable-name.jpg
From: phoca_thumb_l_IMGxxx.jpg To: phoca_thumb_l_new-human-readable-name.jpg

I'd rather (of course...) write a simple rule that would cover all these cases, something like:
From: {some-macro-and-regex-magic}IMGxxx.jpg To: {some-macro-and-regex-magic}new-human-readable-name.jpg
where the picture file name would be the only matching pattern, while the suffixe of the picture file name (if there is one) would not get modified.

Can this be implemented in ReDJ ? I haven't been able to find the way to do it. :dry:

Please Log in or Create an account to join the conversation.

More
9 years 9 months ago #2856 by admin
Try this rule:
From URL: IMGxxx\.jpg$
To URL: {scheme}://{siteurl}{pathrtrim IMGxxx.jpg}new-human-readable-name.jpg

Kind regards,
Luigi
The following user(s) said Thank You: Akuna

Please Log in or Create an account to join the conversation.

More
9 years 9 months ago #2857 by Akuna
Works perfectly! Thank you!!!

Please Log in or Create an account to join the conversation.

More
9 years 9 months ago #2865 by admin
U're welcome. :)

Please Log in or Create an account to join the conversation.

Time to create page: 0.126 seconds