PDA

View Full Version : Automatically resize IMG tags in user signatures?


jkotlowski
02-01-2016, 03:50 PM
Hi, I thought for the longest that the sizing options for signatures in the admin CP allowed you adjust the max size of anything in the signature, BBcodes included. But it seems I was wrong.

Is there a method for automatically sizing IMG bbcode in the signature? I'd like to set a maximum of around 500 pixels in width, if possible.

MarkFL
02-01-2016, 04:30 PM
You could create a plugin as follows:

Product: vBulletin

Hook Location: parse_templates

Title: Restrict size of images in signatures

Execution Order: 5

Plugin PHP Code:

if (in_array(THIS_SCRIPT, array('showthread', 'private')))
{
$template_hook['headinclude_css'] .= '<style>.signaturecontainer img {max-width: 500px;}</style>';
}

Plugin is Active: Yes

Click "Save".

jkotlowski
02-01-2016, 08:53 PM
You could create a plugin as follows:

Product: vBulletin

Hook Location: parse_templates

Title: Restrict size of images in signatures

Execution Order: 5

Plugin PHP Code:

if (in_array(THIS_SCRIPT, array('showthread', 'private')))
{
$template_hook['headinclude_css'] .= '<style>.signaturecontainer img {max-width: 500px;}</style>';
}

Plugin is Active: Yes

Click "Save".

Hi, thanks for the reply.

I'm having some difficulty here. This would be implemented through the "Hooks & Products System" correct?

If so, there's no "parse_templates" in the hook location drop menu.

Dave
02-01-2016, 09:03 PM
You could also just add
.signaturecontainer img {max-width: 500px;}

To the CSS/additional.css template.

MarkFL
02-01-2016, 10:08 PM
Hi, thanks for the reply.

I'm having some difficulty here. This would be implemented through the "Hooks & Products System" correct?

If so, there's no "parse_templates" in the hook location drop menu.

I didn't notice this was a vB5 request...when you see this thread in the "New Posts" search, that information doesn't show up for some reason.

So yes, just add it to the additional CSS template as mentioned. :)

jkotlowski
02-01-2016, 10:42 PM
Thanks for the help, both of you. It seems there's a bug with VB 5.2.0 that doesn't allow me access to the template edits... lol.

I'll install the patch to fix that early in the morning when traffic is low and add it to my additional CSS then. :)

Replicant
02-02-2016, 02:37 AM
Thanks for the help, both of you. It seems there's a bug with VB 5.2.0 that doesn't allow me access to the template edits... lol.

I'll install the patch to fix that early in the morning when traffic is low and add it to my additional CSS then. :)

FYI, even after the 5.2.1 patch, I had issues in AdminCP with Firefox but Chrome worked perfectly.

jkotlowski
02-02-2016, 10:21 AM
So... I've added the code to the additional.css section of my styles. And it doesn't seem to be having any effect on image sizes in the signature.

.thread-view .b-avatar--m {
height: 130px;
width: 130px;
}
.thread-view .b-avatar--m > img {
max-height: 130px;
max-width: 130px !important;
}

.l-small .topic-list-container .topic-list .cell-count {
padding-bottom: 0;
}
.l-small .topic-list-container .topic-list .topic-item td.cell-lastpost {
display: block;
padding: 0 5px 5px;
}
.l-small .cell-lastpost .avatar {
display: none;
}
.l-small .cell-lastpost .lastpost-by {
font-size: 0.9em;
color: #6A6A6A;
display: inline;
}
.l-small .cell-lastpost .lastpost-by:before {
content: "Last post ";
}
.l-small .cell-lastpost .post-date:before {
content: "on ";
}

.restore table[align=center] {
margin: 0 auto;
}
.signaturecontainer img {max-width: 500px;}

Am I supposed to add something to it...?

Thanks for the help. :)

MarkFL
02-02-2016, 10:29 AM
It is possible your version of vB uses a different CSS class...please post a link to a page on your site where a signature is visible, and I will look at the page source. :)

final kaoss
02-02-2016, 10:30 AM
Try this.
#content img {
max-width: 100px;
width: 100%;
height: auto;
}

*might be wrong, just waking up.

jkotlowski
02-02-2016, 11:39 AM
It is possible your version of vB uses a different CSS class...please post a link to a page on your site where a signature is visible, and I will look at the page source. :)

http://www.t5forums.com/forum/main-forum/on-topic/161438-why-are-signatures-this-big-allowed?p=161772#post161772

Thanks. :)

Try this.
#content img {
max-width: 100px;
width: 100%;
height: auto;
}

*might be wrong, just waking up.

This did make signatures smaller. But it also made every other image on the page the same size, including the smilies. So, close! Thanks for trying. :)

MarkFL
02-02-2016, 12:07 PM
Okay, please try:

.post-signature img {max-width: 500px;}

jkotlowski
02-02-2016, 12:14 PM
Okay, please try:

.post-signature img {max-width: 500px;}

Worked beautifully! Thanks so much. :)