ElkArte Community

Elk Development => Bug Reports => Exterminated Bugs => Topic started by: radu81 on January 24, 2016, 06:58:12 am

Title: Images not resized into signatures for guests
Post by: radu81 on January 24, 2016, 06:58:12 am
I have set images in the signature to be resized and this is working fine, but I have noticed that as guest I see the full dimension of image in the signature. Is this a bug or is something wrong with my forum?
Title: Re: Images signatures for guests
Post by: emanuele on January 24, 2016, 07:57:41 am
/me feels he forgot something while working on simplifying the bbc resize... O:-)

ETA: this code change is not necessary, see messages below
In Load.php, try adding:
Code: [Select]

if (!empty($modSettings['signature_max_image_width']) || !empty($modSettings['signature_max_image_height']))
{
$context['html_headers'] .= '
<style>
.signature .bbc_img.resized {' . (!empty($modSettings['signature_max_image_width']) ? '
max-width:' . $modSettings['signature_max_image_width'] . 'px;' : '') . (!empty($modSettings['signature_max_image_height']) ? '
max-height:' . $modSettings['signature_max_image_height'] . 'px;' : '') . '
}
</style>';
}


just before:
Code: [Select]
	// Any files to include at this point?
call_integration_include_hook('integrate_theme_include');
Title: Re: Images signatures for guests
Post by: radu81 on January 24, 2016, 12:47:10 pm
Thanks Emanuele, I tried but nothing changed, images are still showed at 100%.
you can see it here: skodaclub.it/index.php?topic=5685.msg92923#msg92923
Title: Re: Images not resized into signatures for guests
Post by: emanuele on January 24, 2016, 02:56:10 pm
Never mind, that code is not necessary: did you run the task to update the signatures based on the new settings?
Title: Re: Images not resized into signatures for guests
Post by: radu81 on January 24, 2016, 03:36:34 pm
I did not run the task, should I make the edit and then run the task?
Title: Re: Images not resized into signatures for guests
Post by: emanuele on January 24, 2016, 03:48:26 pm
Yep, there is a blue notice at the "top" of the settings (below the menu) with the instructions (well, just a "press here").
It is like that because signatures have more than just image size limitations and all of them are not fixable with just css. ;)
Title: Re: Images not resized into signatures for guests
Post by: radu81 on January 24, 2016, 04:05:19 pm
I tried with original Load.php and then run the task but did not help. I tried with the edit you suggest on Load.php and then run the task but nothing changed. Could it be something related to fancybox addon? The fancybox addon is opening signature images into lightbox, as guest and also as normal user
Title: Re: Images not resized into signatures for guests
Post by: emanuele on January 24, 2016, 04:49:56 pm
It is indeed:
https://github.com/Spuds/Elk_FancyBox/blob/master/sources/fb4elk.subs.php#L237
for guests width and height are not set.
Just remove that condition and make the sizes be always set and it should fix it:
Code: [Select]
			if ($user_info['is_guest'])
$style = '';
else
$style = 'width:{width};height:{height}';
should become just:
Code: [Select]
			$style = 'width:{width};height:{height}';
Title: Re: Images not resized into signatures for guests
Post by: radu81 on January 24, 2016, 05:06:58 pm
That worked perfectly! Thank you for your help. Maybe @Spuds will want to add this into Fancybox
Title: Re: Images not resized into signatures for guests
Post by: Spuds on January 24, 2016, 05:50:10 pm
I'm not sure what I need to add or what its not doing that it should  O:-)
Title: Re: Images not resized into signatures for guests
Post by: emanuele on January 25, 2016, 02:06:02 am
At https://github.com/Spuds/Elk_FancyBox/blob/master/sources/fb4elk.subs.php#L237 FancyBox is texting if the user is gues or not, if it is guest the whole image without size limits is shown, if it is a registered user the resized image is shown (i.e. width:100px;height:100px).
I'm not sure why guests are not allowed to see smaller (or bigger actually :P) images, though this breaks the image limiting is signatures because it relies on the setting of width and height of the img tag.

I'm not sure if this sounds any better, but replacing the code I posted about should fix it (unless there is a reason to the different displaying ;D).
Also, it's for sure not the best fix, but... :P
Title: Re: Images not resized into signatures for guests
Post by: radu81 on January 25, 2016, 04:46:29 am
Quote from: emanuele – Also, it's for sure not the best fix, but... :P
BUT it works  ;)