espenmn
(Espen)
March 15, 2018, 5:56pm
1
I have a browser view that sends emails (to groups) with content of the current document.
Inside the html, links to the image would be 'resolvedid' which in the email would then be 'http:/../../images/etc/etera.jpg'
What is the best way change all 'internal URLs' (in body_text) ?
zopyx
(Andreas Jung)
March 15, 2018, 6:18pm
2
No need for changes id you ask me since image urls based on resolveuid will be resolved correctly...or?
espenmn
(Espen)
March 15, 2018, 7:10pm
3
no…
When you see a page in Plone, the image tag is
<img src="resolve_something…"/>
When I try to mail the body_text, for example by constructing the mail body with:
context.text.output
the image URLs are
<img src="../../some/where/my_image.jpg">
I want the link to be:
<img src="http://mydomain.com/some/where/my_image.jpg" />
(since I am importing the source of the email into something else )
So what I really want to know is:
Is there something else I can use than context.text.output which would include the full URL ?
zopyx
(Andreas Jung)
March 15, 2018, 7:27pm
4
i don't know why images references by UID would be translated to relative URLs...this makes no sense to me.
Anyway....parse the HTMl yourself using an HTML parser and fix the URLs to your needs.
-aj
espenmn
(Espen)
March 15, 2018, 7:47pm
5
espenmn:
context.text.output
After some digging I noticed something weird (at least to me):
If I do:
context.text.raw
All imagetags are src="../resolveuid
But if I do
context.text.output
Scales of the images are
src="../resolveuid
while the full image (original size) is
src="http://some.com/full/path/to/image.jpg "
1letter
(Jan)
March 15, 2018, 8:38pm
6
I don't know if this helps, a Transform that use Richtextfield with output_relative_to(context), found in Plone Rest API
zopyx
(Andreas Jung)
March 16, 2018, 10:41am
7
Never seen relative link like `src="../resolveuid" ....why would a UID reference contain a relative path component?
espenmn
(Espen)
March 16, 2018, 4:19pm
8
… no clue but this is what it outputs:
context.text.output
or
context.text.output_relative_to(context)
produces:
<img alt="" src="../resolveuid/fa288d0a8f9c42e7adf357cd8d65fe98/@@images/image/large" class="image-inline"/>
<p>Before you start exploring your newly created Plone site, please do the following:
<img src="http://localhost:8080/mymime/skjermbilde-2018-03-09-kl-12-28-16.png" title="Skjermbilde 2018-03-09 kl. 12.28.16.png" alt="Skjermbilde 2018-03-09 kl. 12.28.16.png" class="image-inline"/></p>
cekk
(Andrea Cecchi)
March 16, 2018, 9:40pm
9
Maybe is related to this topic ?
I don't know why we need to add relative paths to resolveuid, if it works on the root.