With your suggestion: <img alt="BG Lift M250" class="img-full-responsive s-rounded" src="/user/pages/02.products/01.special_equipment/01.mini-cranes/01.bg-lift-m250/m250_01_model_800x800.jpg">
Then, when resizing the browser, the browser will display the image at 50% of the viewport when the window is wider then 26rem, else it will be full width.
Never used it, so this is as far is my help reaches…
@anon76427325
many thanks fo suggestion… after various test… to use this part of code is unnecessary…
is only necessary to add to images filename @2x at the end of name, and Grav scale the images… with, or without adding “size” parameters on twig template.
Seem really strange also to me… but is true.
I’d also tested “Sizes with media queries” parameters, and “Sizes with media queries using derivatives”, as indicated in the official documentation. Nothing change. I can use the previous code:
@msa, I’m confused… (I seem to be confused a lot last few days…)
You said:
I can use the previous code: <img src="{{ image.url }}" class="img-full-responsive s-rounded" alt="{{ post.title }}">
only adding @2x on filename, and Grav scale.
Do you mean your solution is using the following loop?:
{% for image in page.media.images %}
<img src="{{ image.url }}" class="img-full-responsive s-rounded" alt="{{ page.title }}">
{% endfor %}
This way, you will only get a single scaled down (1x) image on every device regardless its screen width and density.
For exampe, if the page on disk is named ‘retina@2x.jpg’ and has an intrinsic width of 800px (2x), your above Twig code will generate the following HTML using an image of 400px (1x) wide:
It that the result you were looking for? If not, what exactly are you trying to achieve?
NB. If you want to mark your issue as being solved, you can use the ‘solution’ button at the lower right corner of any reply. That way, readers will know which reply contains the solution.
@anon76427325, if I not add @2x, the derivatives not works… tested.
if I replace <img src="{{ image.url }}" class="img-full-responsive" alt="{{ post.title }}"> with {{ image.derivatives(200,800,200).html() }} , in this part of code:
nothing happen… the size remain big, and filename of image remain the same I uploaded with @2x at the end. Tested.
I’m sure I’m doing something wrong, and appreciate a lot your help, but probably something depend by my custom template, with custom css. Or… depend by OWL. I don’t know.
Event if the above code is being generated, you still might not see any difference in the browser when resizing. You might need to refresh the page after resizing, because the browser has to re-evaluate which image fits best and fetch it from the server.
To see which image is being shown, you could:
Right click the image in the browser and open in new tab
Or, open the dev tools window of the browser, open the network tab and see which image is loaded when refreshing the page.
Did you disable cache in ‘config/system.yaml’ while testing?
Have you tried deleting all subfolders of ‘/images’ in the root of the site? Are new subfolders being generated with different sizes?
Have you tried clearing the ‘/cache’ folder in the root of your site?
<div>
<img alt="xxxx250" class="img-full-responsive" src="/images/f/7/5/9/3/f7593cbcd7870c4d9c835d3cd5083bd559f1c78e-bgliftradiooptional01800x8001x.jpeg" srcset="/user/pages/04.parts/bg-lift-parts/scanreco-radio-remote/bglift_radio_optional_01_800x800@2x.jpg 800w, /images/a/a/f/e/f/aafefea6ccd61fbc55ee503d6e05e3dbcc28322c-bgliftradiooptional01800x800200w.jpeg 200w, /images/1/6/a/6/9/16a691ad157197131eaba7455f4938f725976ef7-bgliftradiooptional01800x800400w.jpeg 400w, /images/1/0/6/1/6/1061601df1280397a4e59cd3f07710f6960977de-bgliftradiooptional01800x800600w.jpeg 600w, /images/f/7/5/9/3/f7593cbcd7870c4d9c835d3cd5083bd559f1c78e-bgliftradiooptional01800x8001x.jpeg 400w" sizes="100vw">
<blockquote>
<p class="text-justify"></p><p>Scanreco Radio Remote control with display xxxx</p><p></p>
<cite>Radio Remote</cite>
</blockquote>
</div>
but… if I check the image, from the browser, right click etc…, is the big version, not the scaled version… double check with gtmetrix, not all images are scaled…