Client request: images inside "body" field - options and suggestions?

Recommended Posts

this is old question (and problem) - what is the best option to allow clients to place images inside text in editor field ("body")?
Please note that I am not meaning here about default editor image button, because that is bad for administration, clean text data, responsive design etc...
My client request is to get them option to create rich content like on many popular world news portals. As one example they want option to insert gallery in some part of text.

My answer was that with PW are many, many options how that could be solved - but need to find what is the best for all (user friendly for "editors" (role), clean data storage, manipulation with data and frontend rendering).

There are options like using custom markuptags (eg. ![images](1,2,3), or PW Hanna code [[images=1,2,3]]) or another option with repeatable block (editor + image field).

What I don't like with markup tags is storing custom (strange) txt format in field, and not so user friendly (could be optimised with custom editor plugin).

Using repeatable block can be more user friendly than using macros, but repeatable blocks, are repeatable... and want to avoid later complexity (export, import...).

Share this post

Link to post

Share on other sites

the only userfriendly take that i know is going with the repeater matrix or pagetable route, in one project i drilled it with PageTableExtended with rendered Output on Admin Side and different "blocks" of content that a editor could add such as galleries, maps, text with image right or left....and full control over markup on frontend.

WYSIWYG with full power is always a mess...on every system.

If i've time to play i would try out a combination of repeater matrix for the storage in admin and some kind of "add block" layer on frontend with frontend edit for the single blocks...so user works complete in frontend....this would be one step more userfriendly since everyone see instant like it is rendered in frontend...but that is just in my mind for now

Share this post

Link to post

Share on other sites

You take a repeater, and add all the fields you'll need for all types of content block: body, title, images, etc.

You add another field called type, make it an options field, and get in there all the types of block you need. Text, image gallery, video... whatever.

Then you customise each field's visibility to appear only when type=1, for example.

That will allow the admin to freely add a chunk of text, then a gallery, then more text... No weird tags to remember, simple and straightforward.

On the frontend, you make include files for each type (remember the options field) to keep it neat and tidy, foreach the repeater, and include() the correct block template file according to the value of the type field. Generate away.

Share this post

Link to post

Share on other sites

@Macrura do you think it would be possible to update your module to also import images that were pasted from the clipboard? There is a ckeditor plugin that handles pasted image already. Maybe that could be a great addition!