Page Index Toggle Pages: [1] 2 3 4 Send TopicPrint
Very Hot Topic (More than 25 Replies) Smart Image Resize Mod (Read 27407 times)
tompocz
Full Member
***
Offline


The WORST day fishing
is better than the BEST
day

Posts: 124
Location: Adelaide
Joined: Dec 27th, 2002
Gender: Male
Smart Image Resize Mod
Dec 28th, 2005 at 12:29pm
Print Post  
This mod uses javascript to resize avatars, attachments and pictures inserted using the [img] tag if they exceed a maximum size, while maintaining the original aspect ratio of the image.
Original code written by BHRA Webmaster. Every effort has been made to contact BHRA Webmaster in seeking permission to port his mods from 1.3 t YaBB 2.1, but with no response.
Approval has been given by Michael Prager to post this mod.

FYI:
     1 -- The mod below has been converted from 2 YaBB 1.3 mods, the smart_resize_SP12-13 & smart_resize_attachments mods
     2 -- I take credit for the convertion, and not for the logic - this must got to BHRA Webmaster & Michael Prager
     3 -- This mod replaces the option of "User Pic" in Forum Settings with the "Avatar" setting, so as to keep such common functionalities in one area.
     4 -- Laslty, this my first attempt at mod writing, so dont shoot the messenger !!

Notes:
     1 -- The maximum allowed image width and height is now set under the banner of Installed Mods.
     2 -- There are seperate settings for: avatars, attachments, images in messages and images in signatures.
     3 -- The [img] tag can now contain width, height, align and alt attributes in any order or combination.
     4 -- The align attribute can take the standard align values of the <img> tag (left, right, top, texttop, middle, absmiddle, baseline, bottom, absbottom).
     5 -- If you specify the width or height, the image will be resized to that width or height while maintaining the aspect ratio of the original image.
     6 -- If you specify both the width and height, the image will be resized to the size specified, adopting the specified aspect ratio.
     7 -- If the image exceeds the maximum allowed size, it will be resized to the maximum allowed size while maintaining it's original aspect ratio or the specified aspect ratio.
     8 -- If the users browser does not support javascript, the normal (unresized) image will be displayed.
     9 -- Includes the [img] tag bugfix by Michael Prager, and images are restricted to files with a .gif, .jpg, .png or .bmp extension.

Installation:
     1 -- VERY IMPORTANT that you uninstall any previous versions of this mod
     2 -- Install new version and upload files to their appropiate directory in ASCII.

           AdminIndex.pl
           Admin/ModList.pl
           Admin/Admin.pl
           Admin/AdminSubList.pl
           Admin/AdminEdit.pl
           Templates/default/default.html
           Sources/Display.pl
           Sources/Load.pl
           Sources/Printpage.pl
           Sources/Profile.pl
           Sources/YaBBC.pl

     3. Upload the Smart_Image_Resize.txt file to the Variable directory in ASCII.
     4. Upload the Language files into their repective directories in ASCII.

     Many thanks to Larian - German Translation Language File.
     Many thanks to RuKo - Dutch Translation Language File.

History:
     Beta 1 -- Initial Mod
     Beta 2 -- Resolve issues with avatars not showing. Code inserted to resolve this, into Load.pl file
     Beta 3 -- Re-wrote Mod to conform to BoardMod Mod writing standards - as a Mod under the "Installed Mods" banner in Admin Center
     Beta 4 -- Added German Language File
     Beta 5 -- Added Dutch Language File
« Last Edit: Jan 6th, 2006 at 11:36am by tompocz »  

smart_image_resize_beta5.zip ( 8 KB | Downloads )

The WORST day fishing is better than the BEST day working !
Back to top
WWW  
IP Logged
 
Larian
Senior Member
****
Offline



Posts: 316
Location: Leipzig
Joined: Oct 22nd, 2002
Gender: Male
Re: Smart Image Resize Mod
Reply #1 - Dec 30th, 2005 at 8:07am
Print Post  
Hi!

Installed your Mod and it installed fine!
But i found a error:
On the place of the avatars in a thread there is only the text:
Quote:
" alt="" title="" border="0" style="max-width: 65px; max-height: 65px;" />


Found out, that the tags <img src=" and >" are delivered from outwhere and i changed line 472 in Load.pl from
Quote:
${$uid.$user}{'userpic'}    = qq~<img src="${$uid.$user}{'userpic'}"$userpic_tmpwidth$userpic_tmpheight style="display:none" onerror="javascript: this.style.display = 'inline'" onload="javascript: if (this.style.display == 'none') {resize_img(this, $userpic_width, $userpic_height, 0, 0)}" alt="" border="0">~;


to

Quote:
${$uid.$user}{'userpic'}    = qq~${$uid.$user}{'userpic'}"$userpic_tmpwidth$userpic_tmpheight style="display:none" onerror="javascript: this.style.display = 'inline'" onload="javascript: if (this.style.display == 'none') {resize_img(this, $userpic_width, $userpic_height, 0, 0)}" alt="" border="0"~;


But now there are some double tags.
The html looks like:
Quote:
<img src="http://www.4u-treff.de/yabbfiles/avatars/personal/Marcus.jpg" style="display:none" onerror="javascript: this.style.display = 'inline'" onload="javascript: if (this.style.display == 'none') {resize_img(this, 65, 65, 0, 0)}" alt="" title="" border="0" alt="" title="" border="0" style="max-width: 65px; max-height: 65px;" />


Other errors i didn't found.

Larian
  
Back to top
 
IP Logged
 
Larian
Senior Member
****
Offline



Posts: 316
Location: Leipzig
Joined: Oct 22nd, 2002
Gender: Male
Re: Smart Image Resize Mod
Reply #2 - Dec 30th, 2005 at 8:10am
Print Post  
Oh, another thing:
for german translation i added the following to the mod:

Quote:
<edit file>
Languages/Deutsche_Du/Admin.lng
</edit file>

<search for>
'476' => "Benutzerbild Breite (0 = ohne Limit)",
'477' => "Benutzerbild Höhe (0 = ohne Limit)",
</search for>

<replace>
'476a' => "Maximale Benutzerbild Größe (0 = ohne Limit)",
'476b' => "Maximale Bildergröße (0 = ohne Limit)",
'476c' => "Maximale Signaturbild Größe (0 = ohne Limit)",
'476d' => "Maximale Anhangsbild Größe (0 = ohne Limit)",
'477a' => "Breite:",
'477a' => "Höhe:",
</replace>

But i'm thinking, it's better to make a own file for it!

Larian
  
Back to top
 
IP Logged
 
tompocz
Full Member
***
Offline


The WORST day fishing
is better than the BEST
day

Posts: 124
Location: Adelaide
Joined: Dec 27th, 2002
Gender: Male
Re: Smart Image Resize Mod
Reply #3 - Dec 30th, 2005 at 8:14am
Print Post  
Thanks for that - I have aleady found one bug involving avatars not showing, but will resolve this and include the german translation in the next beta.

cheers and thanks
Tom
  

The WORST day fishing is better than the BEST day working !
Back to top
WWW  
IP Logged
 
Jeff
God Member
*****
Offline


There are no bugs there
are only features

Posts: 2552
Joined: Jan 14th, 2005
Gender: Male
Re: Smart Image Resize Mod
Reply #4 - Dec 30th, 2005 at 8:31am
Print Post  
Hi
and

'477a' => "Breite:",
'477a' => "Höhe:",

second 477a should be 477b  Smiley
  

greetings
Jeff
Back to top
WWW  
IP Logged
 
Larian
Senior Member
****
Offline



Posts: 316
Location: Leipzig
Joined: Oct 22nd, 2002
Gender: Male
Re: Smart Image Resize Mod
Reply #5 - Dec 30th, 2005 at 10:22am
Print Post  
Thanks JetLi Wink

@tompocz: You have to change the second 477a to 477b in the english Admin.lng too!

Larian
  
Back to top
 
IP Logged
 
tompocz
Full Member
***
Offline


The WORST day fishing
is better than the BEST
day

Posts: 124
Location: Adelaide
Joined: Dec 27th, 2002
Gender: Male
Re: Smart Image Resize Mod
Reply #6 - Dec 30th, 2005 at 11:43am
Print Post  
GDay All,

I think I have resolved the avatar issue, and a new version of this mod has been uploaded into the first post of this thread.

Please ensure you "uninstall" all previous versions prior to using this updated mod.

Lastly, I have been informed by Michael Prager, that I should infact write this mod so that it falls under the "Installed Mods" in the Admin Center. I am in the process of doing this, and I will ensure I incorporate the above issues ie the typos in Admin.lng and also the German Language File.

Some may ask why I didnt do this in the first place - answer - with the above new version mod, I can atleast get it out to you guys for testing.

cheers
Tom
  

The WORST day fishing is better than the BEST day working !
Back to top
WWW  
IP Logged
 
Jeff
God Member
*****
Offline


There are no bugs there
are only features

Posts: 2552
Joined: Jan 14th, 2005
Gender: Male
Re: Smart Image Resize Mod
Reply #7 - Dec 30th, 2005 at 2:06pm
Print Post  
Hi
beta 2 works great. thnx.  8)
  

greetings
Jeff
Back to top
WWW  
IP Logged
 
tvg
New Member
*
Offline


I love Steam

Posts: 4
Location: Alkmaar
Joined: Jun 3rd, 2005
Gender: Male
Re: Smart Image Resize Mod
Reply #8 - Dec 30th, 2005 at 6:22pm
Print Post  
Cheesy
Hello

Thanks I was looking for this mod

Works great

tvg
  
Back to top
WWW  
IP Logged
 
tompocz
Full Member
***
Offline


The WORST day fishing
is better than the BEST
day

Posts: 124
Location: Adelaide
Joined: Dec 27th, 2002
Gender: Male
Re: Smart Image Resize Mod
Reply #9 - Dec 31st, 2005 at 3:32am
Print Post  
I have changed the mod so that it is an independant one, outside from Admin.pl, and falls under the "Installed Mods" banner in the Admin center.

To this end, it allows for different types of language files.

I am half way modifying it to suit the above, and now require any translations for the following, of which I will include in the next beta...........

%Smart_Image_Resize_txt = (
'1' => "Smart Image Resize",
'2' => "Maximum Avatar Size (0 = disable limit)",
'3' => "Maximum Image Size (0 = disable limit)",
'4' => "Maximum Signature Image Size (0 = disable limit)",
'5' => "Maximum Attachment Image Size (0 = disable limit)",
'6' => "Width:",
'7' => "Height:",
'8' => "This mod uses javascript to resize attachments, avatars and pictures inserted using the [img] tag if they exceed a maximum size, while maintaining the original aspect ratio of the image.<br />Author: Original code by BHRA Webmaster. Converted to YaBB 2.1 by Tom Poczman.",
);

1;
  

The WORST day fishing is better than the BEST day working !
Back to top
WWW  
IP Logged
 
tompocz
Full Member
***
Offline


The WORST day fishing
is better than the BEST
day

Posts: 124
Location: Adelaide
Joined: Dec 27th, 2002
Gender: Male
Re: Smart Image Resize Mod
Reply #10 - Dec 31st, 2005 at 10:13am
Print Post  
Have updated this mod to conform to Mod writing standards - upload the new beta from the first post

Comments and feedback welcomed

cheers
Tom
  

The WORST day fishing is better than the BEST day working !
Back to top
WWW  
IP Logged
 
Jeff
God Member
*****
Offline


There are no bugs there
are only features

Posts: 2552
Joined: Jan 14th, 2005
Gender: Male
Re: Smart Image Resize Mod
Reply #11 - Dec 31st, 2005 at 10:43am
Print Post  
Hi
thnx, works great  8)
  

greetings
Jeff
Back to top
WWW  
IP Logged
 
Jeff
God Member
*****
Offline


There are no bugs there
are only features

Posts: 2552
Joined: Jan 14th, 2005
Gender: Male
Re: Smart Image Resize Mod
Reply #12 - Dec 31st, 2005 at 11:47am
Print Post  
Hi tompocz
Can you make mod settings in Seperate File? Because all another mods becomes seperate files like this from Countdown Mod:

Admin/Countdown.pl

You can make this too. Example

Admin/Smart_Image_Resize.pl
  

greetings
Jeff
Back to top
WWW  
IP Logged
 
tompocz
Full Member
***
Offline


The WORST day fishing
is better than the BEST
day

Posts: 124
Location: Adelaide
Joined: Dec 27th, 2002
Gender: Male
Re: Smart Image Resize Mod
Reply #13 - Dec 31st, 2005 at 1:22pm
Print Post  
I dont think so, as there are too many files which this mod is dependant on like Load.pl Profile.pl and Display.pl

Countdown.pl is unique in the sense that it may make a minor change to BoarIndex.template, but its main logic CAN be placed into its own perl script.

Your post also begs the question as to why ?? - just curious
  

The WORST day fishing is better than the BEST day working !
Back to top
WWW  
IP Logged
 
Jeff
God Member
*****
Offline


There are no bugs there
are only features

Posts: 2552
Joined: Jan 14th, 2005
Gender: Male
Re: Smart Image Resize Mod
Reply #14 - Dec 31st, 2005 at 1:28pm
Print Post  
ok, but all Mod with setting that I have installed have seperate setting file.

Eventcalendar
Hidden mod
Link IP
News Fader Update
Print Who is online
Quick Reply box
Recent Userlist
User Today
Who is where
Simple Spoiler

What do you think?

Roll Eyes
  

greetings
Jeff
Back to top
WWW  
IP Logged
 
Page Index Toggle Pages: [1] 2 3 4
Send TopicPrint