Archive for the 'Scripts' Category

Custom avatar image upload for bbpress

By default, bbpress shows the user’s Gravatar using his/her email ID. This can be changed by avatar-upload, a plugin for bbpress. This plugin for bbpress allows users to upload an avatar (gif, jpeg/jpg or png) image to bbPress, and provides template functions to display the uploaded image. Other features :

  • Admins can configure maximum allowed file size (bytes) and dimensions (pixels) of images from within the admin page (credit: Sam Bauers).
    • Images that exceed maximum dimensions are automatically resized (and sharpened if truecolor images).
  • Anybody with the ‘moderate’ capability can upload another user’s avatar

User uploaded images can be used to show the user’s avatar in bbpress forums.

Download from : http://bbpress.org/plugins/topic/avatar-upload/

PHP function for Javascript redirect

The following code is basically JS, but has been made into a PHP function so that it could be invoked with different parameters as per our needs.

<?php
function js_redirect($url, $seconds=5) {
echo
“<script language=\”JavaScript\”>\n”;
echo
“<!– hide code from displaying on browsers with JS turned off\n\n”;
echo
“function redirect() {\n”;
echo
“window.location = \”" . $url . “\”;\n”;
echo
“}\n\n”;
echo
“timer = setTimeout(’redirect()’, ‘” . ($seconds*1000) . “‘);\n\n”;
echo
“–>\n”;
echo
“</script>\n”;

return true;
}

js_redirect(http://blogulate.com,1); //Redirects to blogulate.com in 1 second.

?>

Eg Usage :
js_redirect(http://google.com,5); //Redirects to Google after 5 seconds.

Spellify : automatic input field spell check

auto spell check on input text field spellify

Spellify automatically checks for spelling errors on user entered text in input text fields. Spellify is powered by the Google™ spell checker. You can see a demo at te homepage and also download the latest version there. Spellify not only works for text fields, but also on text areas.

swfIR : Flash Image enhancements

Add great flash effects to existing images on you site/blog using swfIR..

Effects include Elastic header image (Automatically resizing images  according to text size changes by user), rotated image within content, smooth rounded edges to images, shadow effects etc..

SWFIR - flash image enhancement to your existing images on blog or site

HomePage : http://www.swfir.com/

Great looking charts in seconds with Open Flash Chart

Open Flash Chart lets you make great chart/pie representations from you data for a great looking output. The data file is either a text file, or a .php, Perl, Python, Java (or another flavour of dynamic) page.

make flash graphs and charts

Pie chart using flash

Open Flash Chart, is open source. It is free to use and you get the source code to fiddle with!

# Charts Available
* Data Lines
* Bar Chart
* Bar Chart 2
* 3D Bar Chart
* Glass Bar Chart
* Fade Bar Chart
* Sketch Bars
* Area Charts
* Bars + Lines
* Pie Chart
* Pie Chart Links
* Scatter Chart
* High Low Close
* Candle

# Other Features :

* Chart Title
* Line and Key
* Tool tip
* Background Style
* Background Image
* Inner Background Style
* Null data values
* X Offset
* Bar Links
* Format Numbers
* Do more with less
* Pareto chart

# Helper classes * Java
* Perl
* Python
* Ruby and Rails
* PHP
* .NET

Download Open Flash Chart Open Flash Chart Latest : Version 1.9.6 (550 Kb)

PHP Performance Benchmark Script

/*

PHP Performance Benchmark Script

Copyright 2003 : PHP Consulting

There are two settings:

First, set $file to be the server and page that you want to benchmark.

Secondly, set $iter to be the number of times you want it loaded.

*/

error_reporting(E_ALL ^ E_NOTICE); //For disabling non fatal error outputs

$file = "http://127.0.0.1/Joomla/index.php"; //Location to file

$iter = 5; //No of times to check

function getmtime()

{

$a = explode (' ',microtime());

return(double) $a[0] + $a[1];

}

for ($i = 0; $i < $iter; $i++)

{

$start = getmtime();

file ($file);

$loadtime += getmtime() - $start ;

$intertime = getmtime() - $start ;

echo $intertime . "<br>" ;

$avgload = $loadtime / $iter;

}

echo "<p><b>Average" . $avgload . "</b>" ;

?>