-
Notifications
You must be signed in to change notification settings - Fork 10.7k
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
Fix image stretching #544
Fix image stretching #544
Conversation
By setting height to 200 you were causing images to stretch. Setting it to a max-height, makes it fit auto resize to fit your max height.
Doing that, messages start to move up and down until all images has loaded and their size was setted. Another ideia keeping the height of image content fixed? |
Maybe: <template name="oembedImageWidget">
<a href="{{url}}" target="_blank">
{{#if parsedUrl}}
<blockquote>
<div style="background-image: url({{url}}); background-size: contain; background-repeat: no-repeat; background-position: center left; height: 200px;" ></div>
</blockquote>
{{/if}}
</a>
</template> |
looks like just putting a div around it and doing:
Might do the trick. Are there performance gains from doing css side vs img tag? |
I didn't remember why we use img instead div with background. Do you remember @engelgabriel? |
Just realized something. You'll probably want to stick to img. Especially if you do end up implementing #537 Could do something like:
Then clicking what ever button you use you could do something like:
Obviously there are other ways.. |
I don't know, probably we will sove the #537 using a more complex html to render instead the image to show the file type and file size. We can do this changes in click event and changing some flag in message to force re render with the image visible. |
This way area doesn't expand after the image loads causing content to shift.
Ah yeah. I've also gone similar routes on other projects. Changed to a fixed height div. If css is more performant. I'll gladly make the change. Just trying to help make things look good :) |
I don't know about the performance impact but I prefer the my suggestion, looks more clean and keep image vertical centered if height is less than 200px. |
Suggested by @rodrigok. Looks much better on small images to be aligned in the center. Especially if height needs to remain at 200px;
…cketChat#544) * Adds extra option to trigger change in tray icon When minimizing/restoring the window it doesn't fire the "open/close" events, so if you minimize it and right-click the tray icon you will see "Hide" option, clicking it won't change anything as the window is already hidden * Removes console.log * On clicking and window visible, should close it if window is visible left-click should hide it
…cketChat#544) * Adds extra option to trigger change in tray icon When minimizing/restoring the window it doesn't fire the "open/close" events, so if you minimize it and right-click the tray icon you will see "Hide" option, clicking it won't change anything as the window is already hidden * Removes console.log * On clicking and window visible, should close it if window is visible left-click should hide it
…nection Don't load the Smarti Widget if Smarti is disabled
…cess [NEW] Add feature to post process push message and display as a rich message
By setting height to 200 you were causing images to stretch. Setting it to a max-height, makes it fit auto resize to fit your max height.
This would fix #543