0

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.

0

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. – GraphicsMuncher Sep 8 '18 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) – 4k4 Sep 9 '18 at 9:02

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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