How do I limit size of photos/other media (height, width) on timeline?

Jacob Lesher Posted in Performance and Scalability 7 years ago

While doing a little bug testing, I realized that I could upload a photo 1px wide * 100.000px long and essentially push all other content out of the way. I'd like to know how I could go about modifying the CSS container for .ossn-wall-item.post-contents.

I can implement this code max-height: 10%; max-width: 10%;and reduce the size of posts to only a percent of their original size, however, uploading a photo with a 1.000.000px height will still appear as 100.000px.

Replies
us Jacob Lesher Replied 7 years ago

Very much a theoretical issue, but one that has the potential for abuse.

You're welcome.

German Michael Zülsdorff Replied 7 years ago

Well,
first of all I think that someone's posting a weird image like that is very much a theoretical issue.
Next, we have to avoid fixed widths and heights wherever possible to keep a theme scalable and responsive with all kind of devices.
Maybe we can add a plausibility check on picture dimensions in php with one of the next versions instead.
Thanks for your hint.

us Jacob Lesher Replied 7 years ago

I figured out what I was doing wrong. I was trying to change the size of the div container for wall-item, rather than the image container. The default size of the container is 468px * 270px, so I set the maximum image height and width to those dimensions and it works great.

ssn-wall-item .post-contents img {
    max-width: 468px;
    max-height: 270px*;
    border: 1px solid #eae8e8;
    display: block;
    margin-bottom: 10px;