I make SVGs using LaTeX and would like to upload both the image and its LaTeX source code when I attach an imagine via CKEditor. I don't want the code to be displayed, just stored with the image so that I can change it later if I need to, or use it as a reference for making more images.

There are already some default fields for images in the upload widget, such as alt-text and caption, so this seems possible. I just want another field called "source" where I can dump the LaTeX.


1 Answer 1


Caption and alt text are not a good example because they are stored where the image is used, not together with the file entity. What you are looking for is File Entity to store the source data in a field of the image file. For new projects you shouldn't use it anymore, because it is deprecated in favor of the Media entity. Media is now in core and when the module is enabled you can add fields directly to the media type Image (/admin/structure/media/manage/image/fields).

Out of the box CKeditor does only provide a button to add file images, which you want to replace with Media. To add media types you need the module Entity Embed until this feature is integrated into core.

  • Looks like the entity will already need to exist. When I hit the entity button I added to the toolbar, it just tells me to "Type label and pick the right one from suggestions." I want to be able to upload the image and set its additional field (source code) inline, as if another entry had been added to the image upload widget. Sep 8, 2018 at 19:24
  • Then use Inline Entity Form or the whole package Media Entity Browser (which has a lot of options to configure, look for tutorials to guide you through)
    – 4uk4
    Sep 9, 2018 at 9:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.