Icon and Account picture should not be resized automatically
  • MrNaseMrNase
    Posts: 108
    Hi there! I just noticed that icons that are smaller than 32x32 are also resized.. Same with account picture.. Those should only be resized if they are larger than the maximum allowed size.. Otherwise I need to edit the pictures before using them and make smaller images larger to avoid the bad quality after Vanilla resized them :(
  • ithcyithcy
    Posts: 1,290
    maybe the canvas could be enlarged instead of the image?
  • lechlech
    Posts: 3,235
    I think that's all handled via CSS by default and not anything in vanilla itselft. Vanilla is only pulling together the linking of those images.
  • MrNaseMrNase
    Posts: 108
    It is? Yeah, the <img />-tag has a fixed with and height.. Maybe Vanilla should check for the image's size after submitting the form, making it smaller if it's larger than the allowed size and leaving it as is when it's smaller :) (This was a suggestion for 0.9.3 ;))
  • lechlech
    Posts: 3,235
    Ok, woops, guess you're right, and it is a fixed width. either way though, it's not being checked, and checking it's size would hinder speed and display of pages one would think. The fixed width is there for a reason, to prevent people from dropping large icons/avatars into that area in the first place that take up a huge chunk of the content and destroy the layout. Not saying that I couldn't slow down some load times by linking my icon to a 2mb image in the first place, but having vanilla check that each time would hurt. Mark, I think I do have a fairly solid idea on how to handle user & role icons that could be uploaded in this scenario without allowing the users to link those images outside of the board if you're willing to listen :) To be added as an extension of course.
  • MarkMark
    Posts: 4,880
    lech is bang on with big icons screwing up the design. Also, xhtml requires that the height and width of an image be defined for valid markup. Having php parse external images for their height and width would be WAY too much overhead for the forum.
  • domdom
    Posts: 116
    Alternatively, if the images were added to the layout via CSS then there would be no resizing. Big images would just be cropped, and small images centered. As an added bonus, it would arguably be more appropriate, since the icons don't add anything to the content, just the style. Of course, it wouldn't be overly easy to provide the dynamic CSS required, but then a challenge is always fun, eh?
  • MarkMark
    Posts: 4,880
    dom: are you up to the task?
  • domdom
    Posts: 116
    Well, as I said, I like a challenge. Where do I start? I'll have a snoop around for docs on adding plugins/modding the code, since I only just came across this lovely piece of technology!
  • lechlech
    Posts: 3,235
    I've actually just started working on this to combat the role icon over-riding user icons. I guess I could include the centering you mentioned there, dom. For this little test case :) I'd leave the coding changes up to mark instead of having 2 or more different versions of the same thing :)
  • MarkMark
    Posts: 4,880
    The documentation is far from complete. If you can figure out how to do the css, I can take care of the rest. Keep in mind that I want Vanilla to validate to XHTML 1.0 Transitional. I'm pretty sure that the height and width of the img tag need to appear in order for that to happen. So css would have to override that. The easiest place to begin would be to download the stylesheet and (either manually by viewing the source and linking it, or downloading the entire vanilla app and getting it out of the styles folder) viewing the source to see the classes on/around the icon / profile pics.
  • lechlech
    Posts: 3,235
    Mark, remember my hide/show panel example not needing height and width in the markup ? :)
  • MarkMark
    Posts: 4,880
    did it? I should go back to bed.
  • lechlech
    Posts: 3,235
    nope, I accidently deleted it too (fuck!) but yeah, all the height and width info was done via css just like the hide/show panel extension is currently rendered. I think defining height and width via markup in xhtml is a no-no to begin with for the most part.
  • domdom
    Posts: 116
    You could do something as simple as:

    &lt;div class="Comment">
    &lt;div class="CommentAuthor">
    &lt;a href="account.php?u=1">&lt;span>&lt;/span>mark&lt;/a>
    &lt;/div>
    &lt;div class="CommentTime">8 minutes ago&lt;/div>
    ...
    &lt;/div>
    And then the following css:

    .CommentAuthor a {
    display: block;
    /* other font styling css here */
    }

    .CommentAuthor a span {
    display: block;
    height: 32px;
    width: 32px;
    background: url(myimage.png) no-repeat center center;
    margin-right: 4px;
    }
    That should do it, but I'll throw together a test page when I get home to demonstrate it.
  • lechlech
    Posts: 3,235
    the actual icon though is located here:

    &lt;div class="CommentIcon"&gt;
    &lt;a href="#"&gt;
    &lt;img src="link/to/icon.gif" height="32" width="32" alt="" border="0" /&gt;
    &lt;/a&gt;
    &lt;/div&gt;
  • domdom
    Posts: 116
    Yes, but I'm suggested removing the img tag entirely, since it is not a content image as such.
  • lechlech
    Posts: 3,235
    ahh, we're going two different ways then. To some respect though, we'll probably need to keep the image tag regardless, otherwise you're going to have a css file soley devoted to feeding you the location of each users custom icon. And I think it's safe to say that Mark and anyone else would surely like to avoid and really hate that. Plus you're going to need that div to know which icon to stick to it either way.
  • domdom
    Posts: 116
    Yes, you're right to say that it would take a whole stylesheet devoted to the custom icons. Unless of course, inline styles were used. After a little reflection, I feel this may be the better solution. As I said, I'll throw together an example and see what you all think
  • lechlech
    Posts: 3,235
    ok, i've whipped up a small test-case concerning smaller icons, although I don't think it's as promising since MSIE is a pile of shit when it comes down to positioning block and nearly any other types of elements no matter what their size. My over all suggestion on how to handle this: not worth the effort really. So if you want a 16x16 icon to fit into a 32x32 icon space, you're just better off resizing the icon... Fighting with css and the box model on this one is more of a chore than a benefit. However I did manage to make the icon display neatly without the extra markup if that's any consolation :P I added another possible solution in this test-case for the user/role/douchebag over-ride and how to treat it better. Mark, if you can point me to a section of where this is in the code without me having to dig for it, I think I might be able to fix it there as well.
  • lechlech
    Posts: 3,235
    oh yeah, the test-case is here : http://www.secondagenda.com/root/icons.html
  • domdom
    Posts: 116
    Test page using purely CSS for the icons: http://evilstreak.co.uk/vanilla/

    This deals with smaller icons (MrNase), the right size (lech), and oversized (Google). And when you disable CSS, you just don't see the icons.

    The source is fairly self-explanatory. A couple of bits of the HTML are changed. and a couple of bits of CSS too. Most of the CSS in the test case is to make it look the default!

    Thoughts?

    edit: I have tested with FF and IE6, but not IE5 which is usually the problem child. It would probably just be a case of fixing up the box model, but would need testing.
  • lechlech
    Posts: 3,235
    Looks good, dom, better than my initial hackery using the existing markup with only a few changes.
  • domdom
    Posts: 116
    Actually, the test page not validating is my bad! I got lazy and just copied/pasted the comment block a couple of times, and didn't change the IDs, so it is upset that each is defined 3 times!

    Underscores as well as dashes are fine for both IDs and classes.

    I've fixed the test page now, must take more care in future.
  • lechlech
    Posts: 3,235
    ok, edited that out. Ok, looks better, any chance of you knocking that together against the regular default style to prove it works :D
  • ithcyithcy
    Posts: 1,290
    i don't think underscores are valid for names in CSS1. not that that matters practically, but they would choke a css1 validator, i guess
  • lechlech
    Posts: 3,235
    well, lussumo validates, I cocked up and validated something else on accident and it failed and I thought it was vanilla. So i take that back entirely.
  • domdom
    Posts: 116
    Sure. I was thinking of getting a working install going, and hacking up the code to change it, but haven't due to the short tags issue I posted. I'll probably get it fixed up tomorrow, but at least we have proof of concept.
  • lechlech
    Posts: 3,235
    just grab my html example and dump it into the base area that your vanilla install is located at. clean out my markup and replace with your example. nothing to it :D
  • MarkMark
    Posts: 4,880
    // nm - I've got a solution
  • domdom
    Posts: 116
    Edited posts get confusing as hell sometimes ^^

    I like to just <del></del> what I wrote, so that you can still follow the flow.

    Also, did this solution have anything to do with all the icons mysteriously disappearing?
This discussion has been closed.
All Discussions

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Login with Facebook Sign In with Google Sign In with OpenID Sign In with Twitter

In this Discussion

Who's Online 1

paintballer82