Vanilla 1 is no longer supported or maintained. If you need a copy, you can get it here.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.
Image Dimensions in Source Code
Hi, I've noticed that when users post large images in a thread, the page will jump to an incorrect location. I believe this is due to the page being loaded to the (at the time) correct position before any images are loaded. Once the images are inserted into the page, the point to which the browser has scrolled is no longer appropriate.
My proposed solution is to create an extension that will:
(1) retrieve an image's height and width using the imagesx and imagesy functions, and
(2) include these in the height and width attributes for the img tag displaying the image.
This will create a blank area in which the image will be placed, and eliminate this page-shifting problem.
(Really, I think this should be coded into Vanilla itself for compliance purposes.)
My proposed solution is to create an extension that will:
(1) retrieve an image's height and width using the imagesx and imagesy functions, and
(2) include these in the height and width attributes for the img tag displaying the image.
This will create a blank area in which the image will be placed, and eliminate this page-shifting problem.
(Really, I think this should be coded into Vanilla itself for compliance purposes.)
0
This discussion has been closed.
Comments
I think we only need to know the height for the scrolling problem ;-)
Open up themes/comments.php, and replace
$CommentList = '';
With$CommentList = '<script>function locateComment(){var l=window.location.toString(),o=document.getElementById(\'Comments\'); if(l.indexOf(\'#Item_\')!=-1&&o){l=l.split(\'#Item_\');l=parseInt(l[1]);l=l>o.childNodes.length?o.childNodes.length:l;l--; l=l<0?0:l;o=o.childNodes[l];o.scrollIntoView(true);}}document.onload=locateComment;</script>';
EDIT: And actually, only the src and alt attributes are required to make an img tag standards compliant: http://www.w3.org/TR/REC-html40/struct/objects.html#edef-IMG