-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
Show image size on view page #25884
Show image size on view page #25884
Conversation
Given the style of these file infos, they don't had a label so far, so I think just |
I just want to make this clear, that these numbers are the size of the image, so nobody is confused. On things like |
I think it's obvious anyways. We could add label tooltips to these items if we really want to show a label. |
I'm not sure if that's obvious for anybody. I think explicit is better than implicit.
This is the only entry in this list that has a Popup, so this would maybe be a little weird. |
We can add label tooltips to all of them. I could likely push that into this PR. |
Also "Size" is ambiguous anyways as we have two sizes: image size and file size. |
Please run |
You can do that, if you want, but I thnk adding Tooltips for others is a bit out of touch for this PR.
Fair point. So it's better to use image size.
Done |
If there is a label / tooltip it should use |
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 think this approach is nice - we just need to take a look at that file header on mobile....
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.
blocking per @mrsdizzie's suggestion of using Dimension vs Size
I still prefer it without a label, it just does not fit to add a label in a list that is only values. Take for example code header, no labels anywhere:
|
It says |
By that notion, you would have to put "pixels", but it's a silly discussion. |
Let's just say |
I would agree with |
I don't think so.... |
if err == nil { | ||
// There are Image formats go can't decode | ||
// Instead of throwing an error in that case, we show the size only when we can decode | ||
ctx.Data["ImageSize"] = fmt.Sprintf("%dx%dpx", img.Width, img.Height) |
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.
why ' !fInfo.st.IsSvgImage()' not svg?
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.
svg is text-based instead of binary, and vector-based instead of line-by-line, so it doesn't really have a "size".
It is only limited by the view box that can be arbitrarily scaled.
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.
Not entirely correct. SVGs can have height
and width
, and if they are absent, the size of the viewport is used IIRC. If even that is absent, browser will use 300×150
IIRC. Still I guess it's enough if this PR handles only raster images for now.
Would you agree with |
|
* upstream/main: (26 commits) Add 'Show on a map' button to Location in profile, fix layout (go-gitea#26214) Use shared template for webhook icons (go-gitea#26242) Reduce margins on user settings page, introduce `flex-container` (go-gitea#26046) Refactor and enhance issue indexer to support both searching, filtering and paging (go-gitea#26012) Show image size on view page (go-gitea#25884) Fix pull request check list is limited (go-gitea#26179) Fix API leaking Usermail if not logged in (go-gitea#25097) [skip ci] Updated licenses and gitignores Fix typo in metadata (go-gitea#26207) Update js and py dependencies (go-gitea#26243) De-emphasize issue sidebar buttons (go-gitea#26171) Don't autosize textarea in diff view (go-gitea#26233) Add `/public/assets` to `.ignore` (go-gitea#26232) Fix attachment clipboard copy on insecure origin (go-gitea#26224) Fix commit compare style (go-gitea#26209) Fix unable to display individual-level project (go-gitea#26198) Fix access check for org-level project (go-gitea#26182) Fixed incorrect locale references (go-gitea#26218) Use calendar icon for `Joined on...` in profiles (go-gitea#26215) Add changelog for 1.20.2 (go-gitea#26208) ...
This simply shows the Image size on the view page. This is useful, if you search a image with a specific size.