vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 3.0 Full Releases (https://vborg.vbsupport.ru/forumdisplay.php?f=33)
-   -   Wide image automatic resize for html and vB tags in posts - fixes template problems (https://vborg.vbsupport.ru/showthread.php?t=67743)

Steve St.Lauren 09-08-2004 04:33 PM

I'll work on this as soon as I get a chance. I haven't been using the WYSIWYG editor which is why I didn't see this.

TruckMuddr 09-08-2004 05:10 PM

allright, I'll await your word.

QATAR SPEED 09-09-2004 03:19 PM

*bump*

Steve St.Lauren 09-09-2004 05:15 PM

Updated the first post with R1.2 which fixes the wysiwyg problem. In the wysiwyg editor the image will be shown full size without the resized image line below it. That was the best solution I could come up with at this time.

Please click install if you use this hack and let me know how this version works for you.

SVTBlackLight01 09-09-2004 10:03 PM

That's the same solution I came up with. I think I may try to use a small image to replace the text so users will know they can click on it for a larger image.

SVTBlackLight01 09-09-2004 10:48 PM

Here is how it turned out.

http://www.modernengineuity.com/foru...hread.php?t=31

Edit: I just discovered it does the same thing with an image.

TruckMuddr 09-10-2004 06:06 AM

ok, I tried installing the upgrade and got this error.

Parse error: parse error, unexpected $ in /home/hpisavag/public_html/forum/includes/functions_bbcodeparse.php on line 1734

So I tried it on the file that I got from the VB zip that didn't have v1.1 on it and still gettin the same error.

TruckMuddr 09-10-2004 06:14 AM

which 1734 is my last line.

Steve St.Lauren 09-10-2004 06:14 AM

What do you have on line 1734 in that file? My functions_bbcodeparse.php ends at line 1729.

TruckMuddr 09-10-2004 06:19 AM

mine end at 1734 with ?> and no spaces after it.

Steve St.Lauren 09-10-2004 06:34 AM

I had an error in one of the edits that duplicated a few lines. I've fixed it in the file.

QATAR SPEED 09-12-2004 10:32 AM

YOU MADE MY DAY :up: Thanks

This Hack should be a Stander hack on any coming VB vir

and it would be nice if there an option on the Admin CP to control the size of the img.

one more thing ..

how can i make the img open in a new window?

*INSTALL*

Steve St.Lauren 09-13-2004 01:42 AM

Quote:

Originally Posted by QATAR SPEED
how can i make the img open in a new window?

Look back earlier in this thread where a guy asked how to make it target="_blank" - the instructions I left after that will do just what you are looking for.

QATAR SPEED 09-14-2004 08:23 AM

done, thanks

ntwrkguy 09-14-2004 10:17 PM

I just installed this as per the attachment and now I'm getting

Warning: Missing argument 2 for handle_bbcode_img_match() in /usr/home/ntwrkguy/public_html/motormanforum/includes/functions_bbcodeparse.php on line 1116


Line 1116 reads
Code:

function handle_bbcode_img_match($link, $iswysiwyg)
as part of the larger mod which requires us to put in
Code:

// Image size hack R1.2
// Modified by SS
// function handle_bbcode_img_match($link)
function handle_bbcode_img_match($link, $iswysiwyg)
//

Help?

Steve St.Lauren 09-15-2004 02:34 AM

You missed doing the part of the hack on lines 153-163 in the hack:

Quote:

In the same file look for this line (around line 1101 after the above change is made):

$bbcode = preg_replace('#\[img\]\s*(https?://([^<>*"' . iif(!$vboptions['allowdynimg'], '?&') . ']+|[a-z0-9/\\._\- !]+))\[/img\]#iUe', "handle_bbcode_img_match('\\1')", $bbcode);

replace with:

// Image size hack R1.2
// Modified by SS
// $bbcode = preg_replace('#\[img\]\s*(https?://([^<>*"' . iif(!$vboptions['allowdynimg'], '?&') . ']+|[a-z0-9/\\._\- !]+))\[/img\]#iUe', "handle_bbcode_img_match('\\1')", $bbcode);
$bbcode = preg_replace('#\[img\]\s*(https?://([^<>*"' . iif(!$vboptions['allowdynimg'], '?&') . ']+|[a-z0-9/\\._\- !]+))\[/img\]#iUe', "handle_bbcode_img_match('\\1',$iswysiwyg)", $bbcode);
//
That's the only place that handle_bbcode_img_match is called from. I italicized and bolded the part of that line that is added.

HaloImpulse 09-17-2004 06:42 AM

Parse error: parse error, unexpected $ in /home/haloimp/public_html/includes/functions_bbcodeparse.php on line 1738

linke 1738 is ?>

wtf?

Steve St.Lauren 09-17-2004 04:39 PM

Check over the hack - you missed something. Specifically look at the lines that start with "function handle_bbcode_img" and "function handle_bbcode_img_match". If you look in the hack directions you are supposed to replace those lines with the lines in the hack. You probably have those lines duplicated - a couple of other people have done that as well. I had an error in the hack instructions that were there for about 6 hours when I first put up this version so if you downloaded it when I first put this version up download it again. If you can't figure it out let me know and I'll PM you my email address so you can send me your functions_bbcodeparse.php file and I'll figure out what's wrong.

HaloImpulse 09-18-2004 01:19 AM

yes i did. I fixed it. But ive come accross a new problem. If a image is thats on the same server is posted on the forums, it says its a broken link. For example, my site: haloimpulse.com

my sig is http://haloimpulse.com/aerotest/aerosig.jpg

however, it says its broken on the forums. But when i host it on my other server, it works fine (http://asylum-designs.com/aero/aerosig.jpg)

Steve St.Lauren 09-18-2004 05:12 AM

Quote:

Originally Posted by HaloImpulse
yes i did. I fixed it. But ive come accross a new problem. If a image is thats on the same server is posted on the forums, it says its a broken link. For example, my site: haloimpulse.com

my sig is http://haloimpulse.com/aerotest/aerosig.jpg

however, it says its broken on the forums. But when i host it on my other server, it works fine (http://asylum-designs.com/aero/aerosig.jpg)

My guess would be that it has something to do with a firewall setting on that server. On the site I run users link to pictures on that server all the time and they work no problem. Try this - replace these lines:

// Image not found
$bbtag='<table border="1" cellpadding="2" id="image_found"><tr><td><FONT color="#FF0000">Image link is broken</font></td></tr></table>';
$image_found=false;

with

// Image not found
$bbtag='<table border="1" cellpadding="2" id="image_found"><tr><td><FONT color="#FF0000">'. $link .'</font></td></tr></table>';
$image_found=false;

and these lines:

// Image not found
return '<table border="1" cellpadding="2"><tr><td><FONT color="#FF0000">Image link is broken</font></td></tr></table>';

with:

// Image not found
return '<table border="1" cellpadding="2"><tr><td><FONT color="#FF0000">'. $link .'</font></td></tr></table>';

That will display the link it's trying to go instead of the "broken link" message. Report back with what that says (in case it's different than http://haloimpulse.com/aerotest/aerosig.jpg ).

HaloImpulse 09-18-2004 04:18 PM

Parse error: parse error, unexpected '/' in /home/haloimp/public_html/includes/functions_bbcodeparse.php on line 1148 :-/

Steve St.Lauren 09-20-2004 12:08 AM

Quote:

Originally Posted by HaloImpulse
Parse error: parse error, unexpected '/' in /home/haloimp/public_html/includes/functions_bbcodeparse.php on line 1148 :-/

Sent you a private message.

HaloImpulse 09-20-2004 11:42 PM

Quote:

Originally Posted by Steve St.Lauren
Sent you a private message.

!!! WURD!

[high]* HaloImpulse has a PM![/high]

HaloImpulse 09-20-2004 11:43 PM

Quote:

Originally Posted by HaloImpulse
!!! WURD!

[high]* HaloImpulse has a PM![/high]

wtf??
Code:

/me
works?? Where can i get the me hack?

ForYou 09-23-2004 07:41 AM

Hello ,

There is Error :( please help

Parse error: parse error in /home/virtual/site4/www/html/montada/includes/functions_bbcodeparse.php on line 1685

Fatal error: Call to undefined function: handle_bbcode_img() in /home/virtual/site4/www/html/montada/includes/functions_bbcodeparse.php on line 640

please help what can i do ?

Regards

Steve St.Lauren 09-23-2004 08:03 AM

Quote:

Originally Posted by ForYou
Hello ,

There is Error :( please help

Parse error: parse error in /home/virtual/site4/www/html/montada/includes/functions_bbcodeparse.php on line 1685

Fatal error: Call to undefined function: handle_bbcode_img() in /home/virtual/site4/www/html/montada/includes/functions_bbcodeparse.php on line 640

please help what can i do ?

Regards

You made a mistake in the hack file from lines 141-151:

Quote:

In the same file look for this line (around line 1088 after the above change is made):

function handle_bbcode_img($bbcode, $dobbimagecode)

replace with:

// Image size hack R1.2
// Modified by SS
// function handle_bbcode_img($bbcode, $dobbimagecode)
function handle_bbcode_img($bbcode, $dobbimagecode, $iswysiwyg)
//
Check those lines out - you have something wrong there.

ForYou 09-23-2004 08:23 AM

Sir,

Please Let me what is the wrong in the the file ,

Regards

ForYou 09-23-2004 08:28 AM

Quote:

Originally Posted by ForYou
Sir,

Please Let me what is the wrong in the the file ,

Regards

Sir ,

there is a new error like this ,


Warning: getimagesize(): stream does not support seeking in /home/virtual/site4/fst/var/www/html/montada/includes/functions_bbcodeparse.php on line 1140

Warning: getimagesize(): stream does not support seeking in /home/virtual/site4/fst/var/www/html/montada/includes/functions_bbcodeparse.php on line 1140

what is the problems

Regards

Steve St.Lauren 09-23-2004 08:44 AM

On line 1122 in your file you deleted several lines from the original code. Starting on line 1122 you should have:

Quote:

$link = strip_smilies(str_replace('\\"', '"', $link));

// remove double spaces -- fixes issues with wordwrap
$link = str_replace(' ', '', $link);
and then on with the hack (which you have in your file):

Quote:

// Image Size hack r1.2
// Modified by SS to resize large pics and place link to full size pic
// return '<img src="' . $link . '" border="0" alt="" />';
I'm not sure if that's what is causing your error or not but it's the only thing I can see wrong in your file. BTW, I believe that they do not want people posting any of the vB files in their entirety on here so you should probably delete that attachment. I have it saved on my machine to give you further help.

ForYou 09-23-2004 08:54 AM

Quote:

Originally Posted by Steve St.Lauren
On line 1122 in your file you deleted several lines from the original code. Starting on line 1122 you should have:



and then on with the hack (which you have in your file):



I'm not sure if that's what is causing your error or not but it's the only thing I can see wrong in your file. BTW, I believe that they do not want people posting any of the vB files in their entirety on here so you should probably delete that attachment. I have it saved on my machine to give you further help.

Sir ,

I was modify the file and uploade it but , there is a new error like this


Warning: getimagesize(): stream does not support seeking in /home/virtual/site4/fst/var/www/html/montada/includes/functions_bbcodeparse.php on line 1144

Warning: getimagesize(): stream does not support seeking in /home/virtual/site4/fst/var/www/html/montada/includes/functions_bbcodeparse.php on line 1144


regards

mr.gamesbay 09-23-2004 09:13 AM

I dont know if u know this problem.
if in a thread are some dead images in it, to open this thread i need more then 2 minutes!?
I remove your code, then all work fine.
Is there a fix for this problem?

Steve St.Lauren 09-24-2004 07:34 AM

ForYou - It looks like your problem is a bug in the version of PHP that your server is running. Try upgrading to a newer version of php if you have that option. If you do a search on yahoo on "Warning: getimagesize(): stream does not support seeking" you'll find a bunch of information on it.

mr.gamesbay - that is a problem with using getimagesize but I haven't found a better solution. If it's taking more than 2 minutes then you must have a LOT of pictures in that thread that are bad links. Timeouts should only happen if the server is unreachable - if the server is reachable and the files just aren't there that should go through fast. The timeout is set to 5 seconds to get a response from the remote server - if after 5 seconds there is no response then it moves on. So to have it taking 2 minutes you'd have to have ~20 pictures on that thread that are linked to a non-active server. There is some discussion at the beginning of this thread on how to do a resize using Javascript that solves this problem but that doesn't work if the pictures are loaded from the cache so IMO it isn't a good solution.

mr.gamesbay 09-24-2004 07:54 AM

Quote:

Originally Posted by Steve St.Lauren
mr.gamesbay - that is a problem with using getimagesize but I haven't found a better solution. If it's taking more than 2 minutes then you must have a LOT of pictures in that thread that are bad links. Timeouts should only happen if the server is unreachable - if the server is reachable and the files just aren't there that should go through fast. The timeout is set to 5 seconds to get a response from the remote server - if after 5 seconds there is no response then it moves on. So to have it taking 2 minutes you'd have to have ~20 pictures on that thread that are linked to a non-active server. There is some discussion at the beginning of this thread on how to do a resize using Javascript that solves this problem but that doesn't work if the pictures are loaded from the cache so IMO it isn't a good solution.

There was only 3 or 4 dead Links in it, not more.
First i think, it was an error with my webspace or my vB, but after i removed the code, the threads opend normal.

The code from Auros i used too, is imo faster, but it have a small bug if i use the WYSIWYG-Editor and i dont know how to remove the bug.


PS: Sorry about my bad English

dis.pater 09-28-2004 10:42 PM

Quote:

Originally Posted by Aurous
Well written code, but pages load really slow! Not good for a big site.

Heres what Ive done, which works on client-side:

PHP Code:

 
//replace (around line 1015) in includes/functions_bbcodeparse.php
 
 
return '<img src="' $link '" border="0" alt="" />';
 
 
//with
 
 
return '<img src="' $link '" border="0" alt="" OnLoad="if(this.width > 500) {this.width=500; this.style.cursor=\'hand\'; this.title=\'Click Here to open the image in a new window\';}" onClick="javascript:window.open(\'' $link '\',\'\',\'scrollbars=1,toolbar=0,resizable=1,menubar=0,directories=0,status=0\')" />'


Thats it. It works fine, but if the images load from your cache, this fails! If theres something that can be done to cached images, this code will work perfectly!

I use this:
Code:

/*
LEAVE THIS NOTICE IN PLACE
FI Image Resizing script - Daz - ForumImages.com
For use and distribution terms please check;
http://www.forumimages.com/terms.php

Modifications by Politics.be
-- Onclick handler is automatically handled bij JavaScript now, compatible with IE and Mozilla
*/
var imgResizeMsg = 'Click to view the image';
var imgWidthMax = 600;
var imgWidthSizeTo = 400;
var imgClassName = 'imglimit';
//window.onload = fiImageResize;

function fiImageResize() {
if (document.images.length) {
var docImg = document.images;
  for ( var i = 0 ; i < docImg.length ; i++)
      if (docImg[i].width > imgWidthMax && docImg[i].id != 'forumlogo') {
        docImg[i].width = imgWidthSizeTo;
        docImg[i].title = imgResizeMsg;
        docImg[i].className = imgClassName;
        docImg[i].onclick = fiImageWinOpen;
      }
  }
}

function fiImageWinOpen(e) {
        if( window.event )
          window.open(window.event.srcElement.src,'PoliticsViewer','menubar=no, toolbar=no, location=no, directories=no, fullscreen=no, titlebar=yes, hotkeys=no, status=no, scrollbars=yes, resizable=yes');
        else
          window.open(e.target.src,'PoliticsViewer','menubar=no, toolbar=no, location=no, directories=no, fullscreen=no, titlebar=yes, hotkeys=no, status=no, scrollbars=yes, resizable=yes');
}

This works with cached images too, plus it saves bandwidth if you have a lot of images since it will only be downloaded once if you put it in a separate file and "include" it with src="" in your script tag.
All you have to do is add fiImageResize() to the onLoad handler of your body tag and it will resize all your images.

If you have images that shouldn't be resized, you have to give them an id and them on the following line:
Code:

if (docImg[i].width > imgWidthMax && docImg[i].id != 'forumlogo')
As style for the resized images I use:
Code:

.imglimit {
        cursor: pointer;
        border: dotted 1px black;
}

It might be usefull to others who don't want to waste load by resizing userposted images.

mr.gamesbay 09-28-2004 11:21 PM

This sounds good, but i dont realy know how to use ist.

This part i must put in the CSS of the Style?! Right?
Code:

.imglimit {
        cursor: pointer;
        border: dotted 1px black;
}

But where i have to put this part?
Code:

/*
LEAVE THIS NOTICE IN PLACE
FI Image Resizing script - Daz - ForumImages.com
For use and distribution terms please check;
http://www.forumimages.com/terms.php

Modifications by Politics.be
-- Onclick handler is automatically handled bij JavaScript now, compatible with IE and Mozilla
*/
var imgResizeMsg = 'Click to view the image';
var imgWidthMax = 600;
var imgWidthSizeTo = 400;
var imgClassName = 'imglimit';
//window.onload = fiImageResize;

function fiImageResize() {
if (document.images.length) {
var docImg = document.images;
  for ( var i = 0 ; i < docImg.length ; i++)
      if (docImg[i].width > imgWidthMax && docImg[i].id != 'forumlogo') {
        docImg[i].width = imgWidthSizeTo;
        docImg[i].title = imgResizeMsg;
        docImg[i].className = imgClassName;
        docImg[i].onclick = fiImageWinOpen;
      }
  }
}

function fiImageWinOpen(e) {
        if( window.event )
          window.open(window.event.srcElement.src,'PoliticsViewer','menubar=no, toolbar=no, location=no, directories=no, fullscreen=no, titlebar=yes, hotkeys=no, status=no, scrollbars=yes, resizable=yes');
        else
          window.open(e.target.src,'PoliticsViewer','menubar=no, toolbar=no, location=no, directories=no, fullscreen=no, titlebar=yes, hotkeys=no, status=no, scrollbars=yes, resizable=yes');
}


dis.pater 09-29-2004 09:11 AM

Quote:

Originally Posted by mr.gamesbay
This sounds good, but i dont realy know how to use ist.

This part i must put in the CSS of the Style?! Right?
Code:

.imglimit {
        cursor: pointer;
        border: dotted 1px black;
}


Correct :)

Quote:

But where i have to put this part?
I placed it in a separate javascript file which I called resizeall.js and uploaded it to the clientscript directory of vB.
All you should do then is add this line at the bottom of headinclude (you find it under common templates in the template manager).
Code:

<script type="text/javascript" src="clientscript/resizeall.js"></script>
At last you should change the onload in the body tag of the showthread template.
On my board, with vB3.3 the body tag now looks like this
Code:

<body onload="$onload; fiImageResize()">

mr.gamesbay 09-29-2004 11:02 AM

Thanks dis.pater! :)
Works PERFECT! :)

mr.gamesbay 09-30-2004 07:39 AM

Quote:

Originally Posted by dis.pater
If you have images that shouldn't be resized, you have to give them an id and them on the following line:
Code:

if (docImg[i].width > imgWidthMax && docImg[i].id != 'forumlogo')

Can u me better explain this part ?
I have a pic. names (back_hi.gif) that shouldn't be resized.

dis.pater 09-30-2004 03:52 PM

Quote:

Originally Posted by mr.gamesbay
Can u me better explain this part ?
I have a pic. names (back_hi.gif) that shouldn't be resized.

First you should add an id to your img tag.
Suppose you have this in your template:
Code:

<img src="back_hi.gif" />
This you should change into (the nr1 could be anything offcourse)
Code:

<img src="back_hi.gif" id="nr1" />
Then you should change this line below (which is in the javascript file)
Code:

if (docImg[i].width > imgWidthMax && docImg[i].id != 'forumlogo')
into (nr1 or whatever id you have choosen
Code:

if (docImg[i].width > imgWidthMax && docImg[i].id != 'nr1')
If you have more than one image you don't want to resize all you got to do is change the line above by adding && docImg[i].id != 'the_image_id' after [i]docImg.id != 'nr1'

edit:
Seems like vB is parsing vB tags inside the code tag :ermm:

johnnyb 10-03-2004 08:44 PM

PHP Code:

Warninggetimagesize([url]http://files.photojerk.com/matthieu/b1.jpg[/url]): could not make seekable - [url]http://files.photojerk.com/matthieu/b1.jpg[/url] in /home/XXX/public_html/forums/includes/functions_bbcodeparse.php on line 1134 

The whole page shows error such as this?

vBulletin Message is this:

PHP Code:

Unable to add cookiesheader already sent.
File: /home/blazini/public_html/forums/includes/functions_bbcodeparse.php
Line
1134 



All times are GMT. The time now is 01:26 AM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01653 seconds
  • Memory Usage 1,872KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (16)bbcode_code_printable
  • (3)bbcode_php_printable
  • (18)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (3)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (40)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete