PDA

View Full Version : How to fix that all inline images are showed only as full?


RedFoxy
03-03-2014, 09:05 PM
Hello!
I've a strange trouble, all the inline images are shown at full size, untile the file is just inserted inline I can change image/thumbnail setting double clicking it, but after I post the message the images are shoe at full size.
I tried to use a CLEAN template and disable ALL mods but nothing... I've vBulletin 4.2.2 and I've that trouble on two different boards.

My template vars about thumbnail are:
Inline Attached Image Thumbnail Maximum Size: 150px
Inline Attached Image Medium Maximum Size: 300px
Inline Attached Image Large Maximum Size: 1024px

Any suggest to fix it?

Lynne
03-03-2014, 09:28 PM
I assume the two forums are on the same server? Have you tried setting up a test site on that server - totally new install - and seeing if you have the same problem right out of the box?

RedFoxy
03-03-2014, 11:18 PM
No I haven't tried, but on vbulletin.com there are other people with same trouble.
I does a video of the trouble: http://www.redfoxy.it/vbulletin_inline.mp4
As you can see, the inline image was translated in [IMG] tag

Barcham
03-04-2014, 02:53 PM
Just out of curiosity, have you verified your image settings in the admincp under Message Attachment Options? There are a few settings there that can affect how images are displayed in posts on the board.

RedFoxy
03-04-2014, 04:35 PM
Just out of curiosity, have you verified your image settings in the admincp under Message Attachment Options? There are a few settings there that can affect how images are displayed in posts on the board.

Yes I do, it's all ok

I've an update for that trouble, looks like thats a trouble of the wysiwyg editor, when I insert inline a thumbnail with the wysiwyg disabled, it insert a tag but if I switch from textual editor to wysiwyg and than I switch again to text it change the attach tag to img tag!

--------------- Added 1393954791 at 1393954791 ---------------

Just to be sure, my Message Attachment Options are:

Limit Space Taken Up By Attachments (Total): 0
Attachments Per Post: 0
Attachment Upload Inputs: 10
Attachment URL Inputs: 10
Allow Deletion of Attachments Beyond Edit Time Limit: no
Allow Deletion of Attachments in Closed Threads: No
Allow Duplicate Attached Images: No
Resize Images: Yes
View Attached Images Inline: Yes, display thumbnails
CMS Thumbnail Override: Yes
Thumbnail Creation: Yes
Thumbnail Size: 100
Thumbnail Quality: 65
Thumbnails Per Row: 5
Thumbnail Color: #000000
Use Image Lightbox: Yes, click
Asset Manager - Enable: Yes, ajax upload by default
Asset Manager - Assets per Page: 20
Advanced Insert Image Popup - Enable: Yes


--------------- Added 1393992215 at 1393992215 ---------------

Ok, now there is something of weird...

Test 1: I tried to install a clean vBulletin 4.2.2 on my official server, using a new DB, after I installed it I tried to verify the inline trouble and that clean vBulletin have that trouble.

Test 2: I've a fresh installed local Virtual Machine with FreeBSD, like the official server, with about all package installed, I tried to installa a fresh vBulletin 4.2.2 but that installation have inline image trouble too...

Test 3: Fresh install of lastes stable Debian with Apache 2 (not Nginx as official server), than I've installed a fresh vBulletin 4.2.2 and... It goes! There isn't inline trouble!

After a fast debug I found similar errors on test 1 and 2:
Warning: preg_match() [function.preg-match]: Compilation failed: invalid range in character class at offset 23 in ..../includes/class_wysiwygparser.php on line 481

Than I tried to understand it and editing includes/class_wysiwygparser.php at 481 I find:
if (preg_match('#attachment.php\?attachmentid=(\d+)#s i', $img_url, $matches) AND preg_match('#class=(\'|"|)([a-z0-9_-\s]+)?\s*previewthumb\s*([a-z0-9_-\s]+)?(\\1)#si', $fullurl))
{
return '[ATTACH=CONFIG]' . $matches[1] . '';
}


To test it I got the 2 variables ($img_url and $fullurl) and I make a file test.php
<?php
$img_url ='http://192.168.1.55/attachment.php?attachmentid=36&amp;stc=1';
$fullurl ='<img src="http://192.168.1.55/attachment.php?attachmentid=36&amp;stc=1" attachmentid="36" alt="" id="vbattach_36" class="previewthumb">';

if (preg_match('#attachment.php\?attachmentid=(\d+)#s i', $img_url, $matches) AND preg_match('#class=(\'|"|)([a-z0-9_-\s]+)?\s*previewthumb\s*([a-z0-9_-\s]+)?(\\1)#si', $fullurl))
{
echo "it's ok";
}
?>

If I run that file on freebsd server it give error:
Warning: preg_match(): Compilation failed: invalid range in character class at offset 23 in x.php on line 5

But if I run it on the Debian server it goes!
That's really strange, some suggest to fix it?

RedFoxy
03-05-2014, 07:14 PM
Ok I got it! PCRE 8.34 have a bug, it's all ok with PCRE 8.33

Barcham
03-05-2014, 07:59 PM
Glad to see you got it worked out! :up:

Lynne
03-06-2014, 02:11 AM
Ok I got it! PCRE 8.34 have a bug, it's all ok with PCRE 8.33
Wow! That's quite interesting. Thank you so much for letting us know what was going on!

tbworld
03-06-2014, 02:30 AM
Ok I got it! PCRE 8.34 have a bug, it's all ok with PCRE 8.33

Thanks for letting us know! :)

I am looking into the changelog for PCRE 8.34 against the expression to see what has changed. If it is not a bug, I will post a new updated expression. Great work!

RedFoxy
03-20-2014, 09:24 PM
Ok I fixed it, in the regex you must change _- with -_

Change:
if (preg_match('#attachment.php\?attachmentid=(\d+)#s i', $img_url, $matches) AND preg_match('#class=(\'|"|)([a-z0-9_-\s]+)?\s*previewthumb\s*([a-z0-9_-\s]+)?(\\1)#si', $fullurl))
With:
if (preg_match('#attachment.php\?attachmentid=(\d+)#s i', $img_url, $matches) AND preg_match('#class=(\'|"|)([-_a-z0-9\s]+)?\s*previewthumb\s*([-_a-z0-9\s]+)?(\\1)#si', $fullurl))

tpearl5
10-01-2014, 06:03 PM
ugg, this was driving me nuts as well. Thanks for posting the fix.

safakuygur
10-29-2014, 07:04 PM
has the same problem . thank you for your help

xony
11-27-2014, 07:47 AM
has the same problem . thank you for your help friend

djbaxter
11-27-2014, 09:41 PM
Where is that regex change made?

Lynne
11-28-2014, 06:54 PM
Where is that regex change made?
In post #5 he says it is in includes/class_wysiwygparser.php at 481.

markoroots
03-13-2015, 05:22 PM
Great bro! You have rock! :)
Many thanks! It work. :)