randomouscrap98 / contentapi

A generic content system to make some kinda standard websites
GNU General Public License v3.0
8 stars 2 forks source link

Adds `maxSize` parameter to `/File/raw/{hash}` route #162

Open ansxor opened 1 week ago

ansxor commented 1 week ago

This adds a new parameter which only applies the resize downward when the image width or height is larger than the specified maxSize.

This contains an implementation for both the direct and imagick image manipulators.

This also disallows size and maxSize from being used together.

https://github.com/user-attachments/assets/87fc1e50-709e-4765-a461-8b4c2ab269fe

randomouscrap98 commented 1 week ago

Your pull is changing the solution to require vs 17. Is there a reason for that? It also changes the ID of the projects in the solution.

Also, I'm not sure if I like this implementation, I have to think about it. It might be more consistent with the rest of the design to make this a boolean flag, like how crop works. Crop changes the meaning of size; this could do the same. Furthermore, images set with "maxsize" will need to be stored separately from images set with "size", as a 100 thumbnail set with "size" will have a different meaning than one set with "maxsize", but here they are named the same. So if a client loads your image first with size=100, then you try to load it with maxsize=100, yours will still return the size=100 version because theirs ran first.

ansxor commented 1 week ago

The solution file was changed so that it would load contentapi.data in the solution when using Visual Studio.

Also, when adding the maxSize, I did add another flag in the thumbnail name similar to size, crop, etc that marks the file with "m{maxSize}". I agree that it could be a Boolean parameter like crop, but I'm not sure what a suitable name would be. Something like "dontUpscale" perhaps?

randomouscrap98 commented 1 week ago

oh shoot how did I miss that, I'm sorry.

I don't quite understand the solution file thing but I don't understand a lot of what Microsoft does lol. I'll just try to open it on my side and see if it's fine