We use cookies to improve your experience. No personal information is gathered and we don't serve ads. Cookies Policy.

ExpressionEngine Logo ExpressionEngine
Features Pricing Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University
Log In or Sign Up
Log In Sign Up
ExpressionEngine Logo
Features Pro new Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University Blog
  • Home
  • Forums

Remove first image tag from {body}

How Do I?

MINDSCREEN's avatar
MINDSCREEN
218 posts
8 years ago
MINDSCREEN's avatar MINDSCREEN

Hi

I want to remove only the first image tag from {body} using find and replace. I have installed {exp:low_replace} plugin, but I can’t able to do. Can anyone Please suggest how to do that OR suggest any other plugin for this?

Regards Debasish

       
Derek Jones's avatar
Derek Jones
7,561 posts
8 years ago
Derek Jones's avatar Derek Jones

Manipulating string content to find HTML tags isn’t ideal; can you describe why you are wanting to do this? That may give someone an idea for a better solution than what you’re trying.

       
MINDSCREEN's avatar
MINDSCREEN
218 posts
8 years ago
MINDSCREEN's avatar MINDSCREEN

I am using the main image as top image, and the same image with different dimensions are in body text too. I want to hide that without all articles.

       
Derek Jones's avatar
Derek Jones
7,561 posts
8 years ago
Derek Jones's avatar Derek Jones

I would recommend adding a File field to your Channel, and possibly an Image Manipulation for the resized version. Then you won’t be using a plugin or PHP to try to perform regex on a string. The output would be as simple as:

Full size:

{news_image wrap="image"}

With a “Small” constraint defined:

{news_image:small wrap="image"}

And simply omit this variable from your tags when you don’t want it to appear.

       

Reply

Sign In To Reply

ExpressionEngine Home Features Pro Contact Version Support
Learn Docs University Forums
Resources Support Add-Ons Partners Blog
Privacy Terms Trademark Use License

Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.