Thumbnail rollover image gallery with captions
This image gallery is implemented in PHP and uses javascript and CSS to display the image under the mouse pointer. The benefit of this rollover effect is that the site visitor can vey quickly browse the images in the gallery. The downside is that all images need to be loaded first. You can see a variant of this gallery in action at http://www.orcabags.co.uk/bags.php
Pleae feel free to use this code in any way you want. If you use it on your website then please let me know. Feedback is always welcome.
The images to display in the gallery are specified in a simple text file that defines the image filename and the caption to use for each image. In this example this file is called gallery1.txt and contains the following lines.
img1.jpg;Image caption 1 img2.jpg;Image caption 2 img3.jpg;Image caption 3 img4.jpg;Image caption 4
The gallery script assumes that you have two folders 'images' and 'thumbs' in the same place as the gallery1.txt file where all the images are stored. The thumbnails should have the same filenames as their full-size equivalents that are stored in the 'images' folder.
In order to implement this gallery on your page you need to insert the javascript block that you get from calling gallery_script() from gallery.php (gallery.php is listed further down on this page). The resulting string should be placed inside the html header.
<?php
// This is done in the page header...
echo gallery_script('galleries/', 'galleries/gallery1.txt');
?>;
Then, in the body of the page, you need to call the function gallery() at the place where you want the gallery to be displayed.
<?php
gallery('galleries/', 'galleries/gallery1.txt');
?>
The gallery is implemented in the gallery.php file and needs to be included at the top of your page.
<?php
require_once('galleries/gallery.php');
?>
The following code is the 'gallery.php' script.
<?php
define('GALLERY_TNWIDTH', '80');
define('GALLERY_TNHEIGHT', '80');
define('GALLERY_NUMCOLS', '2');
define('GALLERY_TNBORDER', '1');
function gallery_script($folder, $gallery, $stickyimage=true) {
$str = "<script language=\"JavaScript\" type=\"text/JavaScript\">\n";
$str .= "<!--\n";
$str .= "var preloadedimages = new Array();\n";
$str .= "var images = new Array();\n";
$str .= "var captions = new Array();\n\n";
$str .= "var blankimage;\n";
$str .= "blankimage = new Image();\n";
$str .= "blankimage.src = \"/img/blank.gif\";\n";
$num = 0;
if (($handle = @fopen($gallery, "r")) !== false) {
// Parse the "images.txt" file and display gallery...
while (!feof($handle)) {
$line = fgets($handle);
$params = explode(";", $line);
$str .= "images[$num] = \"".trim($params[0])."\";\n";
$str .= "captions[$num] = \"".trim($params[1])."\";\n";
$str .= "preloadedimages[$num] = new Image();\n";
$str .= "preloadedimages[$num].src = \"".$folder."images/".trim($params[0])."\";\n";
$num++;
}
fclose($handle);
}
$str .= "\nfunction showimage(id) { \n";
$str .= " var str = \"".$folder."images/\"+images[id];\n";
$str .= " document.getElementById(\"galleryimage\").src = str;\n";
$str .= " document.getElementById(\"caption\").childNodes[0].nodeValue = captions[id];\n";
$str .= "}\n";
$str .= "\nfunction hideimage(id) { \n";
if (!$stickyimage) {
$str .= " var str = \"".$folder."images/\"+images[id];\n";
$str .= " document.getElementById(\"galleryimage\").src = \"/img/blank.gif\";\n"; //str;\n";
$str .= " document.getElementById(\"caption\").childNodes[0].nodeValue = \"\";\n"; //captions[id];\n";
}
$str .= "}\n";
$str .= "-->\n";
$str .= "</script>\n";
return $str;
}
function gallery($folder, $gallery, $stickyimage=true) {
echo '<div style="border:0px dashed blue;padding:0px;margin-top:10px;height:1000px;position:relative;">';
$num = 0; $rows = 0;
if (($handle = @fopen($gallery, "r")) !== false) {
// Parse the "images.txt" file and display gallery...
while (!feof($handle)) {
$line = fgets($handle);
$params = explode(";", $line);
if ($num%GALLERY_NUMCOLS == 0) { /*echo "<br>";*/ $rows++; }
// draw thumbnail...
echo "<a style=\"padding:4px\" href=\"javascript:void(0);\" onmouseover=\"showimage($num);\" onmouseout=\"hideimage($num);\"><img src=\"".$folder."thumbs/".$params[0]."\" width=\"".GALLERY_TNWIDTH."\" height=\"".GALLERY_TNHEIGHT."\" style=\"padding:0px;border:solid ".GALLERY_TNBORDER."px black\"></a>";
if ($num == 0) {
$firstimage = $params[0];
$firstcaption = $params[1];
}
$num++;
}
fclose($handle);
}
$top = 95;
$left = 4;
if (!$stickyimage) {
echo '<br><br><br><br><div style="position:absolute;top:'.$top.'px;left:'.$left.'px;"><img id="galleryimage" border="0" src="/img/blank.gif">';
echo '<br><span id="caption"></span></div>';
} else {
echo '<br><br><br><br><div style="position:absolute;top:'.$top.'px;left:'.$left.'px;"><img id="galleryimage" border="0" src="'.$folder.'images/'.$firstimage.'">';
echo '<br><span id="caption">'.$firstcaption.'</span></div>';
}
echo '</div>';
}
?>
Web Design for The Cambridge Bicycle Doctor
The Cambridge Bicycle Doctor is a ' mobile mechanic' servicing and repairing bicycles in and around Cambridge. The bicycle doctor's website also contains a bicycle accessories shop implemented by means of a Paypal shopping cart.
Web Design for Cambridge Neuroscience
Cambridge Neuroscience asked us to extend their existing website to include and events listing and events registration facility. All work was done to fit within the existing PHP/MySQL framework and site styling.
Cambridge Neuroscience — connecting multidisciplinary neuroscience research and teaching across the University of Cambridge and affiliated Institutes, with a mission to increase our fundamental understanding of brain function and enhance quality of life
Neuroscience has transformed our understanding of the healthy brain and promises treatments for devastating disorders that affect millions of people. As the search for more effective therapies continues, unravelling the complexities of the brain and mind has become a multi-disciplinary enterprise. Neuroscience now transcends biology and, increasingly, involves novel intellectual alliances such as computational neuroscience, social neuroscience, educational neuroscience, neuroeconomics, neurophilosophy and neuroethics.
Cambridge Neuroscience exists as a virtual centre of excellence with crosscutting research programmes in thematic areas.
Bike Hire Online
Bike Hire Online (www.bikehireonline.com) was developed for the the Cambridge Bicycle Doctor to provide a website where users can book and pay for bike hire in and around Cambridge. The site is built in PHP and has an administration interface where the site owner can log in and control stock levels, etc.

Samantha Cooper
"After having a many problems with web designers, I was on the verge of giving up hope that I would ever be happy with my websites. Esscotti Ltd were recommended to me and I thought this would be my final attempt at actually achieving what I wanted. We met discussed ideas, I gave my budget and we worked within that, which was very reasonable.
I was given examples of various different styles, as the main focus on both my websites; www.miss2mrsmakeup.com and www.sam-makeup.com were the portfolio sections, they needed to display a range of images and upload quickly. I had a few ideas of my own, however Arvind gave me great guidance to what we could turn into reality!
I have to say from start to finish I was involved and felt that any changes that were made, were always run past me first. I love both my websites and they have generated me a lot of business. I would certainly advise anyone to get in touch with Esscotti Ltd no matter what their budget. I have had many compliments on them both and I am genuinely very proud of them, a big well done to Arvind."
Samantha Cooper
Professional Makeup Artist
![]()
Menugen
Menugen is a web service designed for caterers, restauranteurs and chefs. Menugen which lets you easily create and change your menus whilst maintaining your design styling.
"MenuGen has helped streamline our catering department and create consistent, attractive menus and save menus for future use." - Mr Brown, Executive Head Chef, Downing College, Cambridge University

an application designed for caterers, restauranteurs and chefs which lets you easily create and change your menus whilst maintaining your design styling.
Phoneapps
Phoneapps is a project that I started sometime around the year 2002 when I puchased the domain www.phoneapps.com. I was writing java apps for mobile phones and this was where I published the apps I made including a mobile book reader and personal tracker programs. However, none of these projects took off so the site was left idle for a few years.
Now phoneapps is a project that I use to learn about building site traffic. My aim is to build site traffic to decent levels and perhaps in the not too distant future I will sell the domain or at least make some regular background bread-and-butter income from it.
If you are interested then please visit the site - Phone Apps
Block Management Online
Block management online is a web service designed for residents' management companies and property managing agents. It provides an administrative tools for anything related to the management of the block and it also provides a stylish website for the management company. The management company website acts as a point of contact for leaseholders and residents and also as a publishing platform for important documents such as insurance documents, standing order mandates, annual return, AGM minutes, etc.
For more information please visit Block management online

Disabling new user email notifications in Wordpress
Sometimes there is a need to disable the email that is automatically sent to newly registered users. One example might be if you are setting up new users in your blog and don't want these new users to be notified until the data-entry has been completed.
This can be done by modifying the file /wp-includes/pluggable.php. Locate the function wp_new_user_notification(). This starts on line 1144 in Wordpress version 2.8.5.
function wp_new_user_notification($user_id, $plaintext_pass = '') {
$user = new WP_User($user_id);
$user_login = stripslashes($user->user_login);
$user_email = stripslashes($user->user_email);
$message = sprintf(__('New user registration on your blog %s:'), get_option('blogname')) . "\r\n\r\n";
$message .= sprintf(__('Username: %s'), $user_login) . "\r\n\r\n";
$message .= sprintf(__('E-mail: %s'), $user_email) . "\r\n";
@wp_mail(get_option('admin_email'), sprintf(__('[%s] New User Registration'), get_option('blogname')), $message);
if ( empty($plaintext_pass) )
return;
$message = sprintf(__('Username: %s'), $user_login) . "\r\n";
$message .= sprintf(__('Password: %s'), $plaintext_pass) . "\r\n";
$message .= wp_login_url() . "\r\n";
wp_mail($user_email, sprintf(__('[%s] Your username and password'), get_option('blogname')), $message);
}
Simply comment out the last line to disable the email..
// wp_mail($user_email, sprintf(__('[%s] Your username and password'), get_option('blogname')), $message);
TinyMCE not working in IE6 – solved
If you got TinyMCE working in most browsers except IE6 then first check how you reference the tinymce javascript file.
We had the following
<!-- TinyMCE -->
<script type="text/javascript" src="../js/tiny_mce/tiny_mce.js"></script>
<script type="text/javascript">
tinyMCE.init({
mode : "textareas",
theme : "advanced"
});
</script>
<!-- /TinyMCE -->
...which is wrong. The correct code is
<!-- TinyMCE -->
<script type="text/javascript" src="/js/tiny_mce/tiny_mce.js"></script>
<script type="text/javascript">
tinyMCE.init({
mode : "textareas",
theme : "advanced"
});
</script>
<!-- /TinyMCE -->
Note the src="/js/tiny_mce/tiny_mce.js" The problem was reported by a client that were using IE6 and could not upgrade to anything else for internal IT-policy reasons. We easily found the error by looking at the apache error logs on their virtual private server which showed.
[Thu Nov 19 13:20:13 2009] [error] [client xx.xx.xx.xx] Invalid URI in request GET /../js/tiny_mce/themes/advanced/editor_template.js HTTP/1.1, referer: http://www.example.com/admin/
It seems the client (the web-client, i.e. IE6) had introduced an extra slash '/' before the javascript filename. Hope this helps someone.
