-
Notifications
You must be signed in to change notification settings - Fork 753
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
Feature/5101 ck editor resize images on upload #5128
Feature/5101 ck editor resize images on upload #5128
Conversation
I have seen the failed test fail for no reason so re-firing the build to see... |
/azp run |
Azure Pipelines successfully started running 1 pipeline(s). |
seems to have worked now |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cool, cool, so looks good to me then
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd like a couple of the manual Dispose
calls converted to using
statements (to avoid things not getting closed if there are errors), otherwise it looks good to me.
var fileStream = FileManager.Instance.GetFileContent(uploadedFile); | ||
var uplImage = Image.FromStream(fileStream); | ||
fileStream.Close(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These need to be disposed, right?
var fileStream = FileManager.Instance.GetFileContent(uploadedFile); | |
var uplImage = Image.FromStream(fileStream); | |
fileStream.Close(); | |
using (var fileStream = FileManager.Instance.GetFileContent(uploadedFile)) | |
using (var uplImage = Image.FromStream(fileStream)) | |
{ |
using (Image newImage = uplImage.GetThumbnailImage(newWidth, newHeight, null, IntPtr.Zero)) | ||
{ | ||
var imageFormat = uplImage.RawFormat; | ||
uplImage.Dispose(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Switching to using
from Dipose()
uplImage.Dispose(); |
DNN Platform/Providers/HtmlEditorProviders/DNNConnect.CKE/Browser/Browser.aspx.cs
Show resolved
Hide resolved
@bdukes thanks for your comments, Do I need to commit your changes? Or did you already do the changes? (I'm a bit scared to mess it up again :-) ) |
I have not applied the changes, you can go ahead and do that. Thanks! |
Did that just now, tnx |
Awesome, thanks @skamphuis |
This PR is a redo of #5123 because of merge/rebase issues. As @valadas advised, I cherry picked the relevant commits, and gave it a quick test based on a fresh 9.11.0 install.
Closes #5101
This PR is built on PR #5122 which was submitted for #5100, but is not necessarily related.
Summary
This PR adds settings for:
And will resize any uploaded image to fit within these dimension on upload.
Since pictures are becoming larger and larger, it can be important on many portals, to have this automatic resize option, to allow users uncapable of resizing images themselves, to upload reasonably sized images.