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

Dynamic Css

How Do I?

Rafael's avatar
Rafael
2 posts
3 years ago
Rafael's avatar Rafael

Hello,

I am trying to create a dynamic blog card.

I would like the freedom to allow users to upload the featured image. Maintain the original image that user uploads without processing/resizing.

I would like to use a css property with a background as a cover.

{exp:channel:entries channel="blog_news" disable="categories"}

                        {blog_card_img}

                        <div class="blogcard_img" (style)="background-image: url({url});width: 100%; height: 350px; background-size: cover;></div> 


                       {/blog_card_img}

                        {/exp:channel:entries}

The above code did not work. It is displaying the image at the tag “{blog_card_img}” it is not getting the image from the {url}. What am I doing wrong here?

The following also did not work.

Link custom stylesheet from EE. Created a css style in EE. Linked in templated.

<link href=”{path={Style/dynamicStyle}}” rel=”stylesheet”>

and the css contains:

/* Blog Cards */ .blogcard_img{ width: 100%; height: 350px; background-image: url({blog_card_img}); background-size: cover;

}

Please help.

Forum was removing code. (style) does not have (parentheses).

       
DigitalSpirit's avatar
DigitalSpirit
11 posts
3 years ago
DigitalSpirit's avatar DigitalSpirit

Have you thought about using an add-on?

Ansel should manage this for you and you - https://www.buzzingpixel.com/software/ansel-ee

Has a 30 day trial.

       
Rafael's avatar
Rafael
2 posts
3 years ago
Rafael's avatar Rafael

Thanks for the tip on the plugin.

Not quite what I am looking for. I’m looking for understanding on the proper way to use EE and its native abilities to the max.

Do you happen to know how to do what I described?

Thanks

       
DigitalSpirit's avatar
DigitalSpirit
11 posts
3 years ago
DigitalSpirit's avatar DigitalSpirit

Yeah should do, my guess is that if it’s not working then it’s a CSS issue that needs resolving.

You should be able to target the image within the div to fill with cover.

       
henrypope's avatar
henrypope
5 posts
3 years ago
henrypope's avatar henrypope

I’m so happy.

       
SaintOtis12's avatar
SaintOtis12
1 posts
2 years ago
SaintOtis12's avatar SaintOtis12

I would like to refer to the method of solving this problem. Minesweeper

       
orborneee's avatar
orborneee
1 posts
2 years ago
orborneee's avatar orborneee

Try to overcome all obstacles to rescue the princess in the Super Mario game.

       
Andrdeaa's avatar
Andrdeaa
6 posts
2 years ago
Andrdeaa's avatar Andrdeaa

To use this feature, open a Module message, dino game then click “Add Cards” and then “Dynamic Cards.” There will be an input section where you can enter the URL of the service that will return the Cards.

       
RafaOMais's avatar
RafaOMais
3 posts
2 years ago
RafaOMais's avatar RafaOMais

This post came up for me. It appears to be a year old. However it does not seem to have a response.

Where you able to find a solution?

Why do did you have the the “style” wrapped in brackets ‘{}’? Perhaps that was the issue.

One more thing that I would suggest is to add a conditional for if there is an image. Or you might get an error if you dont make it required.

Try this code: See if it works.

{exp:channel:entries channel="blog_news" disable="categories"}

{if blog_card_img}
    {blog_card_img}
        <div class="blogcard_img"  url({url});width: 100%; height: 350px; background-size: cover;></div> 
    {/blog_card_img}    
{/if}

{/exp:channel:entries}

       

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.