Skip to:
Content
Pages
Categories
Search
Top
Bottom

Allow Image plugin question

  • @metalvalley

    Member

    Is it possible to add an maxwidth function to the plugin. If yes, what and where?

Viewing 18 replies - 1 through 18 (of 18 total)
  • @fel64

    Member

    It is probably possible; you would have to fopen the image in binary mode, read its width and if that’s too big delete/replace it I think. Quite complicated and very server-intensive.

    The superior solution, in my opinion, is to open your theme’s style.css, look for the #thread li entry and add to it:

    overflow: auto;

    That will then add scrollbars to each post if the width of an image exceeds its specified dimensions (for example, if you explicitly set the width of it (or one of its parent elements) (probably done in your theme already) but not the height, the image would stretch the post to the desired height but add scrollbars to the width).

    Alternatively you could add this to the end of your style.css file:

    #thread li img {
    max-width: 600px;
    }

    Or whatever width you want. This does not work so well; the image will load at full resolution, breaking the layout, and then be resized. It is also only supported by newer browsers; IE 6 will not recognise it.

    @metalvalley

    Member

    For what I’ve seen the last option you gave works the best for me for now. Maybe a resize function will be implemented in the future?

    @thierryyyyyyy

    Participant

    For IE6, there is a “workaround” using “expression(…)” (search google for the rest)

    For getting image width, you can use the PHP function getimagesize() which is incorporated in all PHP 4.3 …. (no need of extra module like GD)

    @mattej00

    Member

    has anyone come up with a good solution to this for us who can’t code php?

    @fel64

    Member

    Yup. 2nd post:

    look for the #thread li entry [in your CSS] and add to it:

    overflow: auto;

    If you want something to physically resize the images, no. A plugin is possible but you’d also have to permanently store all the images on your server.

    @itissue

    Member

    I tried what post #2 did but it doesn’t work. I’m not sure why but it doesn’t. If only you can set the width in the <img/> tag.

    @mazdakam

    Member

    it has conflict with code tag so i decide to disable it

    @edwinfoo

    Member

    Mine is a integrated 0.8.2.1 installation and I’ve tried all the tips on this page and none have worked thus far :-(

    The design can only bear a 600 pixel width limit.

    @fel64

    Member

    You should upgrade.

    What exactly have you tried with what results? Can you link us?

    @edwinfoo

    Member

    http://www.glamrock.com/blog/forum/index.php

    fel64, I can’t see a good reason why I should spend money to upgrade because it’s not something that I can do. Plus I’m worried if all the plugins I’m using work after the transition. Plus I’m not sure if I’ll be going to a different software solution which supports social networking better.

    With regards to pics<600px breaking the site, I’ve tried these additions in the style.css file like you said :

    #thread li {

    min-height: 200px; /* <– add this line */

    padding: 1.5em 1.0em;

    line-height: 1.5em;

    }

    overflow: auto;

    #thread li ol, #thread li ul { margin-left: 40px; }

    #thread li ol li, #thread li ul li { padding: 0; }

    and I’ve tried :

    #thread li {

    min-height: 200px; /* <– add this line */

    padding: 1.5em 1.0em;

    line-height: 1.5em;

    }

    #thread li img {

    max-width: 600px;

    #thread li ol, #thread li ul { margin-left: 40px; }

    #thread li ol li, #thread li ul li { padding: 0; }

    Please forgive my poor development skills. Marketing is my thing.

    @chrishajer

    Participant

    > I can’t see a good reason why I should spend

    > money to upgrade because it’s not something that I can do.

    bbPress == Free Software.

    And actually, spending money when you can’t do something yourself is pretty much how it works. If I can’t rebuild the engine on my car, I pay someone to do it. I don’t think anyone was suggesting you spend more money: upgrading to the latest release is good advice when the software is in BETA. It makes troubleshooting things easier to know you have the latest release. In this case though, I don’t think upgrading will have any effect on this problem. It can be solved with CSS, not new functions or bug fixes from the latest bbPress.

    @chrishajer

    Participant

    Can you link to a post that has a large image that breaks the layout, so we can see what is happening without clicking through all the threads? Thanks.

    @edwinfoo

    Member

    Sorry. Have a look in the second post on this “thread”….

    http://www.glamrock.com/blog/forum/topic/we-got-any-kiss-fans-out-there

    There’s a policy on the site to limit pics to 600px width but no one takes any notice of it. A technical solution would be awesome.

    @chrishajer

    Participant

    edwinfoo: it looks like there’s a problem with the CSS on your site. The #thread li referenced above by fel64 won’t work for you because it looks like you have renamed it to #thread1 (maybe just a typo in your theme.) So, the CSS for #thread won’t apply to #thread1. If you add CSS for #thread1 or remove the 1 from the end of the <ol id=”#thread” in your theme, it works fine (I just tried it.)

    This <ol id="thread1" start="1"> needs to look more like <ol id="thread" start="1">.

    If you need numbers there for each unique thread, you’re going to have to do it differently, not appending a thread number to the end of the id “thread”: that changes the id from #thread to #thread-(whatever number).

    @chrishajer

    Participant

    RE: a technical solution. That’s plugin territory and would require you allowing uploads and storing the files. There have been a few requests lately for allowing attachments but I don’t think anyone has taken up the task. The attachments plugin would allow you to do images as well, I think, or at least the same approach could be used.

    @edwinfoo

    Member

    >If you add CSS for #thread1 or remove the 1 from the end of the

    ><ol id=”#thread” in your theme, it works fine (I just tried it.)

    It didn’t for me. When I edited out the “1”, the design went to crap. I had avatars all over the page so I had to put it back the way it was to keep the site operational.

    Thank you so much for taking the time to looking into this for me. I really appreciate it but I guess my understanding isn’t sufficient enough to explore this any further.

    @chrishajer

    Participant

    I guess I don’t understand the reason for both #thread1 and #thread in the CSS. Why is that? Is your intention that the CSS for #thread also applies to #thread1? (it doesn’t since they are both distinctly named ids.)

    If you want the max width of the images in both #thread1 and #thread to be 600px, you would have to edit the CSS for both those ids.

    You should probably also validate your CSS here: http://jigsaw.w3.org/css-validator/

    Don’t give up on it, I suspect it’s a simple thing you’re overlooking that makes it not work. Maybe it’s as simple as a cached stylesheet so that after you make a change, it still doesn’t appear to limit the width of the image, even thought it would if the new stylesheet was actually used. I find Firefox does that sometimes even after a CTRL-SHIFT-R. View the stylesheet being used to see if it actually has the changes you made in it. If you load the stylesheet URL directly and the changes are not there, CTRL-SHIFT-R that page and usually it loads the stylesheet again, then go back to your webpage and the stylesheet with your changes should be in use.

    Off topic: I wish there were a place one could go to check your site for all the CSS classes, ids and just plain markup you use in the HTML and PHP (web pages), then show you the extra CSS in your stylesheet that is not used in the code at all. That way you could clean the cruft out of your stylesheet and it also might point out things that are not working the way you thought they were.

    @the_wish

    Member

    I was looking into this the other day since I know that phpBB has a plugin to do just that, show a downsized clickable Image to prevent users from messing with the layout.

    Here’s the Demo: http://phpbbegypt.com/PHPBB/viewtopic.php?t=70

    My users are annoying in that aspect. : /

    Wonder if this could be translated into bbPress.

Viewing 18 replies - 1 through 18 (of 18 total)
  • You must be logged in to reply to this topic.
Skip to toolbar