imazen / imageflow-dotnet-server

A super-fast image server to speed up your site - deploy as a microservice, serverless, or embeddable.
https://docs.imageflow.io
GNU Affero General Public License v3.0
252 stars 33 forks source link

Added Added ApplyDefaultCommandsToQuerylessUrls route option #83

Closed msigley closed 1 year ago

lilith commented 1 year ago

As is, this PR can't be merged as it doesn't simply add ApplyDefaultCommandsToQuerylessUrls. It also breaks a fundamental design that allows the project to work.

99.82% of development on this and the related repos is funded by licenses rather than code contributions. Massive corporations (the kind who buy superbowl ads) systematically lie about their size in order to exploit the sliding scale system, and far more exploit the open source method of bypassing the need for a license key. Allowing them to copy and paste rather than create a repository will drastically accelerate violations of the copyleft license and reduce contributions, likely leading to the death of it given where funding levels are at.

While streamlining use by open-source developers remains a goal, I don't see a way to verify that there is a public github/gitlab/etc repository that actually belongs to them and corresponds to the project while also making it a copy/paste-20 chars process to bypass it. If you have a solution to that and want to PR it, I would welcome it.

In the near future, I'm planning to expand the defaults to allow customization by route prefix, so a more general approach might be useful for that.

msigley commented 1 year ago

I'll gladly make changes to this. My goal wasn't to bypass the license requirements, but allow the use of the AGPLv3 and the TOML config file at the same time. If you can point me to a better place in the code to hard code the SetMyOpenSourceProjectUrl that allows the use of the TOML, I'll do that instead in a branch on my fork and remove the my_open_source_project_url TOML addition.

I was a user of ImageResizer.NET as well and customized that to use the nQuant.dll library for encoding PNGs, so I do plan on making more contributions in the future probably related to tweaking the encoding settings for the different image types in the TOML.

lilith commented 1 year ago

Essentially, the design point is that for open source use, you have to compile at least Startups.cs which would contain the call to set your open source url. Does that seem reasonable?

lilith commented 1 year ago

And I absolutely do appreciate your contributions!

msigley commented 1 year ago

I have cherry picked out the open source url changes.

lilith commented 1 year ago

Thanks. Question - will this run for all requests or just image extensions? It could slow apps down (often this is run in process in CMSes etc)

msigley commented 1 year ago

A valid image extension for requests is still validated here: https://github.com/imazen/imageflow-dotnet-server/blob/51faea988c5361fb8f9a1c99d0a3052a3ad600c5/src/Imageflow.Server/ImageJobInfo.cs#L30

It is possible for this to introduce latency or at least unexpected results if the CMS expects the full unprocessed image to be served for image requests without a valid querystring command. The latency should be offset if a cache is setup, but the cache size would obviously have to be much larger to accommodate the increased number of encoding requests. I set the default for this setting to be false for this reason.

msigley commented 1 year ago

I have found this useful in situations where folks who upload images to the server can't be relied to do so in a optimized size or format (i.e. user generated content). I previously had this feature implemented in ImageResizer.NET using IIS Rewrite rules.