Closed phiarchitect closed 6 years ago
Thanks for the contribution!
The resize options are exposed via options
configuration here.
It means that you can do this:
responsive_images:
pattern: '**/*.+(png|jpg|jpeg)'
sizes:
small:
width: 800
options:
withoutEnlargement: false
The example in README is kinda cryptic indeed.
Currently, it's impossible to specify the JPG quality and I'm not sure if it is easy to achieve with the current sharp api or not. Need to investigate it.
Meanwhile, you can decrease the priority of this filter and use another plugin to optimize images, if there is any.
I missed the fact that crop is a separate method, there is no option for that neither. I will try to add both of them then:
I tried the withoutEnlargement option as you specified and it does not appear to work. Does it work for you?
I definitely am available to help and test. This capability is huge for the Photon project. Would love to have a better understanding of how filters work in Hexo. Pretty cool platform.
I've not used withoutEnlargement
yet, will check later today together with other options you have listed.
As for asset filters, I used this: https://github.com/hexojs/hexo-asset-pipeline It does not allow to specify exact quality, but it may be useful anyway.
By decreasing the priority of this filter, the asset-pipeline will be executed AFTER responsive images and all resized images will be available for it to process.
Thank you, Mateusz!
I was wondering if hexo-asset-pipeline
would be a solution before I contacted you. Will look into it. Time to learn how to work with filters in Hexo - as you probably already know the documentation is thin :)
The perfect scenario would be to add full-size original images to source folders and only have the specific resized images be in the generated site. Not sure that is possible yet.
The vision for Photon is to solve common use cases with a curated suite of plugins and a robust modular theme. Cloning Photon should then be a quick start for almost any site. Would love to talk to you more about this if you have time.
Hey @i-am-phi , I've created a branch where all api calls are available via configuration #15
Then you can pass them on the same level as width and height
responsive_images:
pattern: '**/*.+(png|jpg|jpeg)'
sizes:
small:
width: 800
withoutEnlargement: true
crop: north
The options
key I've mentioned earlier allows only to pass a resize options, sokernel
and fastShrinkOnLoad
.
I still need to add specs before merging new options.
Note that the quality settings is not included. It will go separately.
The perfect scenario would be to add full-size original images to source folders and only have the specific resized images be in the generated site. Not sure that is possible yet.
That's perfectly possible and hexo-filter-responsive-images
plugin can help you achieve that. I suggested you assets-pipeline plugin as an addition to handle image minification.
We can talk about Hexo filters, sure. You can create an issues in your repository and set up a discussion. I'm not sure what exactly you would like to know.
Wow - this is tremendous. Thank you for considering my requests! Is the dev branch ready for me to try?
Right now, I am working on integrating current size capabilities I now have into the Photon theme (so I can finish a customer project). Then I want to document my goals for Photon in the project - before I bother you or anybody with it. It is my intention to attract some Hexo experts to the party.
Yeah, that branch is ready for tests. I tested it on my blog and it worked. I just need more time to polish it to merge and release a new version.
Cool - I am watching the repo for updates now. Will probably wait for the release.
Thanks again - from Oregon!
@i-am-phi It's merged to master, I will test it one more time and release a new version this evening or by tomorrow
Still no support for the quality option
@ertrzyiks - Thank you so much for your attention on this. Should have a working demo in Photon by the end of the day today with the current version - then will update when you release. I think the default jpg quality set to 80 should be fine for the time being. The current results are looking good.
Preparing to develop an artist website with over 1000 images so this plugin will be a huge help. Particularly to automate the processing for the customer.
v1.2.0 is out 🎉 you can install from NPM now.
Yeah, I think the default 80% is quite ok. For further improvements, you could try to combine this plugin with assets pipeline as I mentioned before. I will investigate the possibility of controlling jpeg quality setting next week probably.
Let's keep this issue open until we figure it out.
@i-am-phi the quality option will be added with #17
And it has been published via 1.3.0.
Thanks for your contribution!
The Sharp library has support for a number of options in the processing. Can you provide some advice on specifying these in the config file? I am interested in 3 to start:
I would be happy to contribute to your readme file once we figure this out :)