0

There is a core feature that lets you configure where to save inline images uploaded using CKEditor:

enter image description here

Here you can specify the path where you want store inline images.

But this is global configuration, which works for all content types.

I want to have ability to control directory path per content type.

There is a module called File (Field) Paths which gives you ability to configure paths for only file fields under any content type but not for inline images.

Is there any module or a way to implement this?

0

Not directly. The only approach that I could think of right now is that you create a text format for each node type and then use a module like Allowed Formats or Better Formats to limit the allowed formats of each node type to that.

Maybe you can also alter the settings at runtime with some custom code based on the page that you're on right now, but I'm not sure.

  • '#upload_location' => $image_upload['scheme'] . '://' . $image_upload['directory'], -> you can't use tokens, otherwise tokens would've been an easy solution. – Wim Leers Mar 4 '16 at 15:12
  • 1
    Somebody could write a D8 contributed module that hook_form_alter()s EditorImageDialog. That could then add token support. – Wim Leers Mar 4 '16 at 15:14
  • Another possible approach is to upload files using a "File" field or install the Media module and upload files to your site's media library, and then embed those uploaded files using drupal.org/project/entity_embed. – Wim Leers Mar 4 '16 at 15:17
  • Note that inline images are intentionally simple like this. For now, the recommendation would be: create a D8 contrib module that alters EditorImageDialog that adds token support. If that sees enough usage, we can move that into core. – Wim Leers Mar 4 '16 at 15:18
  • Finally, it'd be nice if you'd file this as a support request against drupal.org/project/issues/drupal?component=editor.module in the future. You'd have gotten a better reply there. – Wim Leers Mar 4 '16 at 15:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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