thenewdynamic / hugo-module-tnd-imgix Goto Github PK
View Code? Open in Web Editor NEWA imgix Hugo Module
License: MIT License
A imgix Hugo Module
License: MIT License
Currently transformation is only applied to extension hardcoded in the IsExtensionAllowed.
We should have a setting on the project's level for users to control that.
For now we can map keywords
to certain parameter.
width: w
.
This is cool, but some complex combination of key/value pairs are often used. For example you could often add a facedetection settings which require two params:
fit=facearea&facepad=6
Adding the following shortcode to the mapping config:
imgix:
mapping:
width: w
face:
fit: facearea
facepad: 6
Would allow user to call given shortcodes:
{{ $src := partial "tnd-imgix/GetSrc (dict "src" $src" "width" 500 "snippets" (slice "face") }}
The module will soon be featured in Blog Post and should be appraised for the job.
hugo-module-tnd-imgix
Note that currently GIFs are only enabled for ndbooks.com
Since Gifs are an edge case, if we make changes I'd prefer it not be one that could impact build times.
Sourced from: https://github.com/theNewDynamic/ndbooks.com/issues/162
Gifs solved by Imgix, but we may need to make some adjustments.
Anyways, I've enabled GIFs for your source. It'll take 10-15 minutes for them to re-deploy, but your GIFs should work after that- if they don't, you can use our purge tool to clear the GIFs from our cache, which will fix the issue.
Before you start using GIFs, it's important that you read the information below. Since GIFs are much larger than standard images and can have a much larger impact on your billing overall, I wanted to give you a little more info to ensure the success of the GIFs. The most important thing to do is use auto=format,compress for the animated GIFs. It will actually turn those GIFs into an animated WebP in supported browsers (such as Chrome).
We do not recommend the transformation of extremely large GIFs, extremely long GIFs, or any upscaling of GIFs. Transforming long or heavy GIFs is an extremely time-intensive process that can cause your image rendering to drastically slow down.
Every other parameter is the same except for the quality parameter. Since GIFs operate in such a different way from images, we created a new parameter called gif-q. I would suggest gif-q=35 to gif-q=60. The higher the number, the more compression applied to the GIF.
Just to show you the difference:
This one is 624 KB in Chrome: http://tom.imgix.net/dogmilk.gif?frame=60-130&w=300&h=200&auto=format,compress&gif-q=35
This one without those parameters is 1.7 MB: http://tom.imgix.net/dogmilk.gif?frame=60-130&w=300&h=200
Also, if you wanted to make a larger change (but certainly would require more front end work) you could convert the GIF to an MP4 and use some video tags to make it look like a GIF (
Here is a CodePen example of what I am talking about: https://codepen.io/daletom/pen/EQoazB
For more information regarding GIF parameters, you can read through our documentation below:
https://docs.imgix.com/apis/url/animation
One final note - It's best to not compress your GIFs before serving them with imgix. Since we optimize images, uploading a pre-compressed GIF can have the opposite effect, which can degrade the quality and increase the GIF's file size.
Hello - not sure if this module is still being maintained - nothing seems to render after installation and configuration.
It should be safe to call the GetImgixSRC function with a string pointing to an external image not hosted on imgix. (Some projects might let user either add a relative image which will be pulled from imgix, or an absolute image src from anywhere.
GetSRC/GetImgixSRC should therefor test the url before running their logic.
Currently if user does not have any transformation to apply to an image, they can pass a string as argument:
{{ $image := partial "imgix/GetImageSRC" "/image.jpg" }}
instead of a dict
{{ $image := partial "imgix/GetImageSRC" (dict "src" "/image.jpg" "width" 500") }}
Question Task is, when a string is passed, should we assume the user needs the "default" transformation set in the site config:
imgix:
domain: tnd-backpackers.imgix.net
defaults:
auto: format
ch: Width,DPR
q: 95
Or should we assume they don't need any transformation at all.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.