Comments (8)
Gotcha.
width
and height
aren't actually being set, but being set by the browser from the srcset/sizes which seemingly can't be unset due to https://core.trac.wordpress.org/browser/tags/5.2/src/wp-includes/media.php#L891
It looks like the best option might be to do something where if the second param is something like raw
, it will use a different method for returning the image.
from sage-directives.
How about @image?
from sage-directives.
Didn't see that in the docs at all, i'll dig through the code and see what the params are
from sage-directives.
Ah, it's part of the WP portion of it. You have to hardcode the alt tag tho?
EDIT2: This works, but not exactly ideal as the @image
still hardcodes in the width
and height
. Thanks
from sage-directives.
Does it still hardcode width
/height
with full
passed as the second param?
https://developer.wordpress.org/reference/functions/wp_get_attachment_image/
The directive is more or less the above with some magic for getting the image ID (e.g. ACF fields, etc.) and no $icon
param.
from sage-directives.
@Log1x Yes it does @image('field_name', 'full')
returns the following, I cut out the url's.
<img width="2200" height="1387" src="{url}" class="attachment-full size-full" alt="" srcset="{srcset_urls}" sizes="(max-width: 2200px) 100vw, 2200px">
from sage-directives.
Would it be a duplication or a pain to create a @fieldimage('field', ['param'], 'id')
incase someone actually gets full use out of the @image()
directive?
from sage-directives.
I'm publishing a release now that allows you to pass raw
as a second parameter to return a URL instead of an <img>
. That seems like the best case-scenario with this ticket being set as wont fix
.
from sage-directives.
Related Issues (20)
- Installation, not working for me HOT 2
- Using ACF field name as parameter to @image directive - view not being recompiled when ACF field value is updated. HOT 2
- How to use blade loop variable? HOT 2
- @image directive with ACF field on archive partial not working HOT 1
- `@style` is already in use in Laravel Blade HOT 1
- @noposts missing closing PHP tag
- Randomly Stopped Working, no Error Messages HOT 4
- Can't get this to work - Sage 9.0.10 HOT 2
- @hasfield render argument in wrong place HOT 1
- AFC Link Array Exception Illegal string offset 'title' HOT 1
- Access to Acorn container when Sage not active HOT 1
- Using @field with number as second parameter always returns the string case
- Add missing directive for dynamic sidebars
- Sage directives not working properly in Sage 9.0.9 install HOT 1
- Cannot use the attr parameter with the @thumbnail directive HOT 1
- @thumbnail fails when passing a WP_Post instance as the only parameter
- "Target class [blade.compiler] does not exist" after upgrading to Acorn v3 HOT 3
- Couldn't find a script named "docs:build". HOT 1
- Any plans to add @postmeta()?
- Should this work with Radicle? HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from sage-directives.