Jump to content
Sign in to follow this  
Marcel

Text area field with responsive images (bootstrap)

Recommended Posts

Hey, 

I am very new to processwire and bootstrap. I have a field (text area) and there I want to be able to insert an image which is responsive. I tryed it with Source but in the end the page doesn't seem to like it when I insert in Source the following code

<img src="<?php echo $homepage->content_img->url; ?>" class="img-fluid" alt="Responsive image">

What can I do to make it possible to insert reponsive images in a text area?

Thank you in advance.

Marcel

Share this post


Link to post
Share on other sites

I believe you could achieve this by "Extra Allowed Content" under the input tab for the field itself. I have mine set up with :

img[*]

In your source code (after you have uploaded and image to the ckeditor field), you could then simply add in class="img-fluid" and it would then retain the class. Then in you actual code for the template, just use:

<?= $page->your_field_here; ?>

and the content/image will be output with the correct classes to make it responsive.

  • Like 1

Share this post


Link to post
Share on other sites

Thanks for your help. But there is no "Extra Allowed Content" available or I cannot find it. Do I have to install "Front-End Editing" first?

Share this post


Link to post
Share on other sites

Thanks for your help. But there is no "Extra Allowed Content" available or I cannot find it. Do I have to install "Front-End Editing" first?

EDIT: Was in the wrong field! Sorry. I try it!

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Similar Content

    • By Roberts R
      Hello.
      I never though about it before but when I insert image into CKeditor field I don't get ALT tag filled from image that has it. Do I have to do it manualy for inserted image or Im doing something wrong?
       
    • By Mithlesh
      Changing it to null
    • By Mithlesh
      Hi, I have one URL - writerrelocations.com/contact-now/

      I have one issue where my header Image is appearing again after the contact form, for your reference:



      I have checked my processwire template section where have not added any Image field besides Header Image, attaching the same for the reference:




      PLEASE help me to get rid of the image below contact form

      Waiting for the swift response!

      Thanks
       
    • By tonicastillo
      Hi. Can I ask why this happens?
      When I upload a jpg, the meta keywords and description of the file loses the accents and spanish symbols of the words.
      Original image on the left, and the image generated by PW on resize on the right.

      This happens on resize. The uploaded file is ok.
      How can I control which meta keep in the photo?
      Thanks a lot (and sorry for my English)...
×
×
  • Create New...