Thread: Forum Display Enhancements - Image Resize using Lytebox ( 3.6.x )
View Single Post
  #23  
Old 03-20-2008, 04:42 PM
RedFoxy's Avatar
RedFoxy RedFoxy is offline
 
Join Date: Sep 2007
Location: Italy
Posts: 179
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Ok i do it!

Follow that instructions to enable the autoresieze of images that are linked directly:

follow that instructions ONLY AFTER installed "Image Resize using Lytebox" and edit file includes/class_bbcode.php

Edit file clientscript/lytebox.js and ADD at end of file:
Code:
/*

   "RedFoxy Resize Image" based on "Resize Avatars Based on Max Width and Height" for phpBB (c) Christian Fecteau 2005

	WebSite:	http://www.redfoxy.it
				http://www.forum.redfoxy.it
				http://www.softairmania.it

	Original Credits must be given with my full name (Christian Fecteau)
	and a link to my portfolio: http://portfolio.christianfecteau.com/

	Removal or alteration of this notice is strongly prohibited.

*/

function rfrs_im(rfrs_obj, rfrs_max_width, rfrs_max_height)
{
	if (!document.getElementsByTagName || !document.createElement)
	{
		return;
	}
	var rfrs_real_width = rfrs_real_height = rfrs_offset_width = rfrs_offset_height = false;
	if (rfrs_obj.width && rfrs_obj.height)
	{
		rfrs_real_width = rfrs_obj.width;
		rfrs_real_height = rfrs_obj.height;
	}
	if (!rfrs_real_width || isNaN(rfrs_real_width) || (rfrs_real_width <= 0) || !rfrs_real_height || isNaN(rfrs_real_height) || (rfrs_real_height <= 0))
	{
		var rfrs_rand1 = String(rfrs_count++);
		eval("rfrs_retry" + rfrs_rand1 + " = rfrs_obj;");
		eval("rfrs_x" + rfrs_rand1 + " = rfrs_max_width;");
		eval("rfrs_y" + rfrs_rand1 + " = rfrs_max_height;");
		eval("window.setTimeout('rfrs_img_loaded(rfrs_retry" + rfrs_rand1 + ",rfrs_x" + rfrs_rand1 + ",rfrs_y" + rfrs_rand1 + ")',1000);");
		return;
	}
	if (rfrs_real_width > rfrs_max_width)          { rfrs_offset_width = rfrs_real_width - rfrs_max_width; }
	if (rfrs_real_height > rfrs_max_height)        { rfrs_offset_height = rfrs_real_height - rfrs_max_height; }
	if (!rfrs_offset_width && !rfrs_offset_height) { return; }

	if (rfrs_offset_width > rfrs_offset_height)
	{
		rfrs_obj.style.width = String(rfrs_max_width) + 'px';
		document.all ? rfrs_obj.style.cursor = 'hand' : rfrs_obj.style.cursor = 'pointer';
	}
	else
	{
		rfrs_obj.style.height = String(rfrs_max_height) + 'px';
		document.all ? rfrs_obj.style.cursor = 'hand' : rfrs_obj.style.cursor = 'pointer';
	}
}
Edit file includes/class_bbcode.php and find:
Code:
return '<a target="_blank" href="' . $link . '" rel="lytebox"><img src="' . $link . '" border="0" alt="" /></a>';
Replace with:
Code:
return '<a target="_blank" href="' . $link . '" rel="lytebox"><img onload="rfrs(this, 200, 200)" src="' . $link . '" border="0" alt="" /></a>';
Save all

Note: to change max width and max height for resize, just change the value in includes/class_bbcode.php at rfrs(this, 200, 200)
Reply With Quote
 
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01244 seconds
  • Memory Usage 1,769KB
  • Queries Executed 11 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD_SHOWPOST
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (3)bbcode_code
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_box
  • (1)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (1)post_thanks_postbit_info
  • (1)postbit
  • (1)postbit_onlinestatus
  • (1)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • reputationlevel
  • showthread
Included Files:
  • ./showpost.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/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_postinfo_query
  • fetch_postinfo
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showpost_start
  • bbcode_fetch_tags
  • bbcode_create
  • postbit_factory
  • showpost_post
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • showpost_complete