Replacing image URL in WYSIWYG content
Hi! I've been attempting to change (using velocity) some content from the WYSIWYG editor.
I need to have the full URL for the image appear in the final page. I can get the full path, but not the site name. I've attempted to use .replaceAll to add it in, but for some reason it strips out the "http:"
Is there a better way? I'm guessing some of my problems are due to the image src being rendered at a different time then the velocity transformation?
Thank you!
Discussions are closed to public comments.
If you need help with Cascade CMS please
start a new discussion.
Keyboard shortcuts
Generic
? | Show this help |
---|---|
ESC | Blurs the current field |
Comment Form
r | Focus the comment reply box |
---|---|
^ + ↩ | Submit the comment |
You can use Command ⌘
instead of Control ^
on Mac
1 Posted by Ryan Griffith on 03 Dec, 2014 01:51 PM
Hi,
When you access the WYSIWYG content using either an Index Block of the Locator Tool, you should see the full path to the image which includes the
site://SITE_NAME
prefix. When you have a moment, please attach your Velocity Format so we can get a better sense of where things are at.Thanks!
2 Posted by diekema on 03 Dec, 2014 04:23 PM
Ahh maybe I'm going at this wrong. Attached is my velocity format
3 Posted by Ryan Griffith on 19 Jan, 2015 04:26 PM
Hi,
My apologies for the delayed response to your discussion, I was going over some older discussions and noticed this one is still open. Were you able to work through your path replacement issue?
Please feel free to let us know if you have any other questions.
Thanks.
4 Posted by diekema on 19 Jan, 2015 08:53 PM
I was! I was turning the content into a serialized string. When I was using replace to change the text, it would work for changing the attributes for a hyperlink no problem.
For Example
#set ($x = $x.replaceAll("<a","<a style='color: #78a22d; text-decoration: none;' "))
But if it was a URL ( I wanted to put the full absolute URL in there as this was an email template) it would fail or give very strange results.
What was happening is the serialized text would contain “site://nameofsite/the url” and it was causing the replace to not work.
But the CMS would format the text at the end and strip the site:// text. So I would never see it. Once I figured that out, I just include it in the replace and voila it works!
Thanks!
5 Posted by Ryan Griffith on 19 Jan, 2015 09:01 PM
Thank you for following up and the additional information on your findings. I am glad to hear you were able to work things out.
I'm going to go ahead and close this discussion, please feel free to comment or reply to re-open if you have any additional questions.
Have a great day!
Ryan Griffith closed this discussion on 19 Jan, 2015 09:01 PM.