espenmn
(Espen)
October 25, 2016, 1:06pm
1
I have a content type ("Book") and another ("Chapter")
Each "Book" content has a folder (images) and several "Chapter".
The images placed in each "chapter" are referenced with src="images/someimage.png" (html made outside of Plone).
How can I make a view both for chapter
http://site/book/chapter/@@chapter_view
and
http://site/book/@@book_view (which shows all the chapters and a few other things....)
without 'loosing the link to the images'
(PS: hardcoding image path would be ok, but TinyMCE converts this to relative link)
zopyx
(Andreas Jung)
October 25, 2016, 3:07pm
2
configure TinyMCE to use UIDs "resolveuid/someuid"
-aj
espenmn
(Espen)
October 25, 2016, 3:17pm
3
I think I need to try to avoid that, since the plan is to later export the content to epub (etc), and then I will have to replace all the links again (??)
zopyx
(Andreas Jung)
October 25, 2016, 3:21pm
4
@registerTransformation
def makeImagesLocal(root, **params):
""" deal with internal and external image references """
destdir = params['destdir']
images_seen = dict()
for img in root.xpath(xpath_query(['img'])):
# don't touch images with attribute internal-image="true" (usually used
# for resource images directly used in a template with a resource
if 'internal-image' in img.attrib:
continue
src = img.get('src')
LOG.info('Introspecting image: {}'.format(src))
result = resolveImage(params['context'], src)
img_obj = result['image']
if img_obj is None:
This file has been truncated. show original
The solution is add your fingertips. You forked already my own code.
-aj