PDA

View Full Version : Big Picture messing up your design? Install this


qualif
04-02-2004, 10:00 PM
hello

how two install this hack ?

Waht this file in the zip

sorry for my english is french

thk

Dimitrix
04-03-2004, 04:01 PM
What does this hack do?
This hack will check if an image that a member of your forums has inserted in the post is below the allowable width. If not, the image will be replaced with a small button that basicly says "Image too big, click here to view". When clicked, the image will appear right in the post but without messing up your forum design one bit.

Example?
Working example can be found here:
http://www.designworldwide.com/forum/t35-s.html
You can also test anything in the thread (in fact, I encourage testing)

Please post any bugs/comments/questions here.
While making this hack I had some trouble with reg. expressions and had to go around them a little (php developers can see this). Ive been coding for years now but never had the need to learn those :p

Anyways,
Enjoy!
Dimitry

P.S. This hack is available for VB3 now, thread here:
https://vborg.vbsupport.ru/showthread.php?p=495676

Dimitrix
04-03-2004, 04:06 PM
If you don't want to use a replacement image and would rather use a simple text link, do the following:

Change this line:

$img_replacement = "images/dww/button_imagebig.gif";

to:

$img_txtreplace = "[Image too big. Click here to view it]";


Then change this line:

$inp_string = "<a href=\"javascript:toggle_imgview('bigimg".$number."');toggle_imgview('bigimg".$number."a')\"><img src=\"".$img_replacement."\" alt=\"\" border=\"0\" /></a><br />\n";

to:

$inp_string = "<a href=\"javascript:toggle_imgview('bigimg".$number."');toggle_imgview('bigimg".$number."a')\">".$img_txtreplace."</a><br />\n";


Change the $img_txtreplace to whatever text you would like to use.
Dimitry

mello_mike
04-04-2004, 06:54 PM
I downloaded this before I noticed this was made for vB2.

Do you think this can work on vB 3 gold?

Dimitrix
04-04-2004, 07:36 PM
I have changed the ZIP file.
Sorry I saved the instructions file as .php, which probably made everything confusing.

qualif: Open the text file and follow directions
mello_mike: I will have to download vb3 and look at it, Ill do that today and PM you with the results.

Dimitry

Dimitrix
04-04-2004, 07:48 PM
Update on the VB3:
I have found where in VB3 this is located and the way it's parsed is pretty much identical.
However I would still require some testing to be done and since I can only run one instance of VB on my server, I cant install VB3 and test.

Im willing to work along with anyone who has VB3 on their server if they give me access to one file (Im a good person I wont steal your files I SWEAR! :))

Dimitry
[edit]
Never mind, I just copy & pasted the necessary functions into a new file and did the testing manually w/o Vb3. Hack works even better, the way Vb3 does [img] parsing is much more efficient and after releasing this hack for v.3 I will rewrite this hack to be more efficient.

Dimitrix
04-04-2004, 08:50 PM
Hack for VB3 done
Please PM me if anyone wants it. I want at least one forum to install it to see if it works (it should) and to also test everything out.

Thanks
Dimitry

MeTaL_oRgY
04-04-2004, 08:59 PM
hummm... WTF??... I want to install this.. but the zip file only has a file with no extension (maybe a jsp file?)... how do I install this!! it´s GREAT!!!!

Dimitrix
04-04-2004, 09:30 PM
If you dont see an extension maybe you have them disabled.
Enable extension view in Windows.

Javascript file is: bigimg.js
If you dont see an extantion by it, just upload it. You dont need to edit it anywyas
Dimitry

Dimitrix
04-05-2004, 01:39 AM
Hack edited massively :p
Works like a charm now

Enjoy
Dimitry

MeTaL_oRgY
04-05-2004, 02:11 PM
can?t get it to work... here it is:
http://zelda.wi3k.net/foro/showthread.php?threadid=72

here?s the error:

Fatal error: Call to undefined function: handle_bbcode_url() in /usr/home/wi3knet/public_html/zelda/foro/admin/functions.php(1200) : regexp code on line 1

this is line 1200:

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


any ideas? :s.... I want this hack sooo bad!!.. My best shot is that I?m missing the js file.. but there?s no js file on the zip.... @@

EDIT
lol, downloaded the js file from ur site and uploaded to the forum root and nothing... :S

cinq
04-05-2004, 02:31 PM
This would slow down loading of the page with the linked images due to the getimagesize() for each of the linked images right ?

Dimitrix
04-05-2004, 02:55 PM
can?t get it to work... here it is:
http://zelda.wi3k.net/foro/showthread.php?threadid=72

here?s the error:

Fatal error: Call to undefined function: handle_bbcode_url() in /usr/home/wi3knet/public_html/zelda/foro/admin/functions.php(1200) : regexp code on line 1

this is line 1200:

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


any ideas? :s.... I want this hack sooo bad!!.. My best shot is that I?m missing the js file.. but there?s no js file on the zip.... @@

EDIT
lol, downloaded the js file from ur site and uploaded to the forum root and nothing... :S

Whoops, my bad. Lack of final test on my part :(
The line grabbed from Vb3 and that function isnt IN Vb2.

Find this line:

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


Replace with:

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


I will update the code in the hack when I get home
Dimitry

MeTaL_oRgY
04-05-2004, 02:59 PM
got this:

Parse error: parse error in /usr/home/wi3knet/public_html/zelda/foro/admin/functions.php(1200) : regexp code on line 1

Fatal error: Failed evaluating code: http://www.iespana.es/IngosRanch/ir_v19.jpg in /usr/home/wi3knet/public_html/zelda/foro/admin/functions.php on line 1200


EDIT

problem above solved (you put a */* instead of a *\* on [/img\], but now the image isn?t rezising.. not even appearing....

it just shows the code:
http://www.iespana.es/IngosRanch/ir_v19.jpg
... look: http://zelda.wi3k.net/foro/showthread.php?threadid=72

cinq
04-05-2004, 04:52 PM
Ok not sure if anyone is facing this problem cos of this hack but try this :

Try linking the URL of an attached image in another post.
The whole post goes blank afterwards.

Does this happen for you ?

Jolten
04-05-2004, 05:16 PM
cinq That's exactly what I get. No button, no image. Text typed into the post will show but with this hack installed the vb img tag is dead.

Dimitrix
04-05-2004, 07:44 PM
Fixed.
Please redownload/reinstall the hack.

For those who have this installed already, its just a matter of replacing the old stuff with the new stuff.

Good luck
Dimitry

MeTaL_oRgY
04-09-2004, 02:45 AM
nice, now it´s working.. i installed another hack that replaced the big imgs with plain text so it doesn´t work on a post, but I have some signatures that are quite big, and there the script works!.. Thnx a lot for this dimitrix!! Excelent job!!

Ghosty
04-20-2004, 07:05 PM
found a bug... if someone does an image tag to a picture that no longer works, it gives the error code

Warning: getimagesize(http://zeetec.net/host/originalnabisco/rennekogif.gif): failed to open stream: HTTP request failed! HTTP/1.1 404 Not Found in /home/hinalove/public_html/forums/admin/functions.php on line 927

Warning: getimagesize(http://www.zeetec.net/host/originalnabisco/rensig.jpg): failed to open stream: HTTP request failed! HTTP/1.1 404 Not Found in /home/hinalove/public_html/forums/admin/functions.php on line 927


which dont exist anymore...

Dimitrix
04-20-2004, 07:10 PM
Yep Ive fixed this a week ago on my own board but havent found time to update the hack.
Replace the handle_bbcode_img_match function with this one:

function handle_bbcode_img_match($link)
{
// IMPORTANT - REPLACE THE FOLLOWING 2 VARIABLES WITH YOUR INFORMATION
$img_replacement = "images/dww/button_imagebig.gif"; // <-- This is the button/image that will be displayed instead of the big image.
$img_max_width = 520; // <-- This is the maximum width that an image is allowed to be viewed safely.

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

// remove double spaces -- fixes issues with wordwrap
$link = str_replace(' ', '', $link);

usleep(1500);
if (@fclose(@fopen("$link", "r"))) {
$img_width = getimagesize("$link");
if ($img_width[0] > $img_max_width) {
srand((double)microtime()*1000000);
$number = rand(10,100);

$inp_string = "<a href=\"javascript:toggle_imgview('bigimg".$number."')\"><img src=\"".$img_replacement."\" alt=\"VB: Image Not Found\" border=\"0\" /></a><br />\n";
$inp_string .= "<div style=\"position:absolute;display:none;z-index:1;width:".$img_width[0]."px;height:".$img_width[1]."px;\" id=\"bigimg".$number."\"><img src=\"".$link."\" border=\"0\" alt=\"\" /></div>\n";

return $inp_string;

} else return '<img src="' . $link . '" border="0" alt="" />';
} else return '<strong>VB Error: Image Not Found</strong>';
}