Liferay is adding extra strings to my Image urls, how to avoid?

Abhirama sundaram, modified 5 Years ago. New Member Posts: 2 Join Date: 1/29/20 Recent Posts
Hi everyone,
I have Author and Remote Live setup in Liferay 7.1,. When I upload an image in the webcontent through a HTML editor field or with Image uploading field, Images gets uploaded successfully and looks fine in Author box but when I push the content to Remote Live,

The URL of the image is getting added with some string like "adbb35e8-03f2-a50a-f872-b10d99eb8015?t=1578605874455"
For Example:
If the image in Author box is like: 
/documents/20126/328532/011420_image1%401x.jpg

After publishing in Remote live boxes it looks like below:
/documents/20126/328532/011420_image1%401x.jpg/d2c59bae-dec9-6d41-0f30-069f75e4619f?t=1578605910684

How could I avoid this strings "/d2c59bae-dec9-6d41-0f30-069f75e4619f?t=1578605910684", I want only this /documents/20126/328532/011420_image1%401x.jpg

This is creating issues while Caching the images

Any guidance will be greatly helpful.

Thanks.
thumbnail
Mohammed Yasin, modified 5 Years ago. Liferay Master Posts: 593 Join Date: 8/8/14 Recent Posts
Hi,
You can try fileShortcut feature in where you can  specify  /documents/shortcutid   for accessing file
https://portal.liferay.dev/docs/7-1/tutorials/-/knowledge_base/t/creating-file-shortcuts
thumbnail
David H Nebinger, modified 5 Years ago. Liferay Legend Posts: 14933 Join Date: 9/2/06 Recent Posts
Abhirama sundaram:

How could I avoid this strings "/d2c59bae-dec9-6d41-0f30-069f75e4619f?t=1578605910684", I want only this /documents/20126/328532/011420_image1%401x.jpg

This is creating issues while Caching the images


That's kind of the point...

The first string is the UUID for the image and is tied to the version of the document.

The t= parameter is the timestamp when the image was modified.Both of these work together to bypass caching layers when the image was updated.

Without them, sure your URL will be shorter, but as you publish a new image browsers won't know they have a stale image and will continue to use the old one.

Then, you're going to be dealing with complaints about broken sites, etc., and you'll be back here asking how to change the cache headers to prevent caching or some such nonsense.

The moral of the story here is that you really don't know more than Liferay. The scenario, as it is, well you might not like it but it is the optimal one that allows for caching to work as long as a new version has not been published. When it has been published, Liferay generates the new URL to correctly get the updated version around any caching between the server and the browser.
thumbnail
Christoph Rabel, modified 5 Years ago. Liferay Legend Posts: 1555 Join Date: 9/24/09 Recent Posts
What issues do you face regarding caching? Why do you need to get rid of those parameters?
How do you cache the images? CDN? Apache/Nginx/Squid/...?
Maybe the tool allows you to configure the caching parameters in a better way?
I am asking, because I'd like to understand where  your problems lie.
Not that I recommend it, but there are ways to change the links, e.g. you could create a JournalArticleLocalServiceWrapper and "fix" the link there. But I would take a step back first and try to solve the caching issue instead of mangling the links.