-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Question: Responsive Images #1348
Comments
Currently not, feel free to send a tested PR
Yes, using a custom path generator |
Thanks a lot @freekmurze for answering. Regarding query no. 1, I tried returning an empty string from the generator but then it generated an error "The expected tiny jpg at |
In that case I'd welcome a fully tested PR that makes the tiny image generators optional 😄 |
@nnvvii
I was wanting to do the same thing. Here's how I handled it in my blade file without publishing any MediaLibrary views. {!! $model->getFirstMedia('preview')->img('', ['class'=>'shadow', 'alt'=>'Sunset']) !!} This generates the following HTML: <img alt="Sunset"
srcset="..."
onload="this.onload=null;this.sizes=Math.ceil(this.getBoundingClientRect().width/window.innerWidth*100)+'vw';"
sizes="14vw"
src="..."
width="1920"
class="shadow"> Hope this helps! |
Can I disable the generate of SVG (base64svg, which is saved as the custom property of media) when auto-generating responsive images? I have no use of it and it's wasting space in DB.
Is it possible to pass on a custom "alt" attribute and CSS classes to the img tag view generated by {{ $yourModel->getFirstMedia() }}. I can modify the view (responsiveImageWithPlaceholder.blade.php) for the CSS classes but what if I want to selectively use those classes at specific parts of the website?
I'm custom generating the responsive images using "FileSizeOptimizedWidthCalculator" class. If the original image size is less than equals to the minimum image size in specified in "finishedCalculating", the library duplicates the image in "responsive-images" folder. Wouldn't it be better to re-use the original image in this case?
Is there a way to optimize the generated responsive images using spatie/laravel-image-optimizer?
Can I remove the "medialibrary_original" part of (FILENAME___medialibrary_original_480_266.jpg) generated responsive images to make the filename shorter in length? Also is it possible to rename "/responsive-images/" folder to something to a shorter name like "/resp/"?
The text was updated successfully, but these errors were encountered: