Loading...
 
Skip to main content

Themes


Image width

My custom theme has a fixed width, so when people upload images that are wider than that (750px including padding/margin), it breaks the page.

At first I edited \lib\tiki-js.js so it resizes EVERY image to 700px width, but I realize that's a bad idea, because of images that are smaller (especially those that are really thin and long height-wise).

So is there a way to fix the width only for images that are greater than 700px in width (that doesn't require people to manually check the width of their images every time they upload a picture and then edit it using an image editor)? Preferably a way where I only have to edit .tpl files and not .php?

Thanks a lot,

Fixed-width themes are 🙀 evil 😉 (unless content is strictly controlled). I don't know a way to limit image width. It's just my opinion, but I think it'd be better to make the theme flexible.

One possible workaround would be to give the wikitext or other center column div a width and an overflow:scroll property (in CSS), so anything wider than the width (like a wide image) would put scrollbars on the div. This would prevent the theme from breaking, but make the center column behave like an iframe, which might confuse users since they'd see the cut-off image but maybe not the scrollbar down at the bottom of the page, if the page is taller than the browser window. I guess you could test it and see how well it works.

-- Gary


hi

we used some javascript which checked each image and resized width and height if width was to big.
not really sexy, but ok...

is there a smarty way to to that ? maybe with a smarty plugin ?


bacca


Actually, I'd be fine with the javascript solution.

bacca, can you show me the code and where to put it?

chibaguy, ... I understand your sentiments towards fixed-width themes. But.. no really, people uploaded pictures that were over 2000 pixels wide. Really.