Scripting

Ramblings and links to interesting snippets


Facebook Connect for phpBB2

Tags: , , , ,

Another mod for phpBB2 that I have just completed is the well sought after “Facebook Connect” mod.  It’s a very straightforward version and should be very simply to install, though I give no guarantee that it will work for you.

I used to JavaScript Api to get the job done.  In a nutshell what it does is it first adds in a column to your User’s table to store someone’s Facebook ID.  Then the first time a user clicks on the “facebook connect” button it will ask the user if they want to link to an existing account or create a new one.  It will then add in the facebook ID to th row for the selected account.  Then the next time a user clicks on the “Facebook Connect” button it will check the User’s table for the user’s facebook ID and automatically log them in.

So, like I said, pretty straight forward.  The forum account will still work independently from Facebook, but will give the user instant activation and a faster way to login.

Features:

  • Instant account activation.
  • Single click log in when user is already logged into Facebook.
  • Allows for linking/unlinking for logged in users.
  • Will add the user’s Facebook avatar if they don’t already have one.

Click here to download the mod

8/02/10 Minor edit needed: It reads “Please submit both an email and password” which should be changed to “Please submit both a username and password”

Permalink » 13 Comments

Image Folder Compressor

Tags: , ,

From my experience Photoshop’s “Save for web and devices” will give you the biggest bang for your buck.  It’ll give you the lowest file sizes with the least amount of artifacts.

However, one problem I had is that it’s difficult to resize a lot of images in bulk.  Especially if you want to compress images in sub directories.  After a lot of searching I came across this useful little snippet.  One thing – it’s only meant for .JPGs.  So any other format and you won’t be finding this so useful…but it might not be too hard to tweak.

To use this first download the script on your computer and open Photoshop.  Go to file>scripts>browse, select the script, then select the folder containing you .JPG images.

You can edit the file in notepad, dreamweaver, whatever.  To change to quality edit this line:
SaveForWeb(saveFile,90); // set quality to suit
Where 90 refers to the quality setting.

I also did some editing to this so it would also resize images before compressing them.  First find the line:
app.preferences.typeUnits = TypeUnits.PIXELS;
After it add:
doc.resizeImage(200, 133);
where 200,133 is the image size.  I think I did have some issues with stretching so check the aspect ratio beforehand.

Download the script here

Permalink » 1 Comment

Javascript Zoom In

Tags: , , ,

For a project I wrote this JavaScript based image zoom in application.   At the time I couldn’t find anything out there that I could use to get the desired effect (at least w/out shelling out some dough) – so I opted to write something myself.

The entire idea was not well received…so I never actually finished it.   So this is essentially just a “proof of concept”.  It demonstrates that you can zoom in, zoom out, and move an image around within a specified area without the use of flash.  I don’t know if I’ll ever get the chance to finish this, or really even have a reason to finish, but so it doesn’t get lost I thought I would post it up here.

Regardless of the outcome it was a good exercise in JavaScript 🙂

Click here to see it in action!

The zoom icons used in this are from Dry Icons

Permalink » No comments

Special Character Converter

Tags: , , , , ,

I’ve created a very, very, simple online converter for special characters.  I’ll often get handed off a Word document with text to be included in a website.  Word by default will create curly quotes, and it may have a myriad of special characters littered in there.  So I made a simple script that replaces special characters with their ASCII entity counterparts.

You Simply copy and paste the text into the large textbox, click on the button and voila!  It does have some limited conversion of ampersands.  It will only convert and ampersands to & if there is a space in from of it to remove the risk of converting any entities that may be already in the code.  So while “Tea & crumpets” will convert “M&M” won’t.

Special Character Converter

Permalink » No comments

Edit Join Date mod for PHPBB2

Tags: , , ,

I have written some mods for PHPBB2 (don’t ask why I’m not on 3 :P)  and I havn’t gotten into the habit of documenting them properly so they can shared, but this time I went through the whole nine yards 🙂  I don’t know how well this file would work with any auto installers, though.

I will give credit where credit it due – this mod is adapted from tomlevens’ “Edit User’s Postcount” mod.

What this mod does is add a field to the user management section of the admin panel which enables you to change a user’s join date.

click here to download join_date.mod

Permalink » No comments