473,804 Members | 2,064 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Javascript image rotation in website

Hi there,

I am trying to include some javascript in my website which rotates some
stored images. I have attached the code for the index page of my
website as i am having some problems getting it to work. Can anyone see
where i am going wrong? This is my first attempt.

Here is the source script:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dt d">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"
/>
<title>??</title>
<style type="text/css">
<!--
body {
background-color: #006699;
margin-left: 0px;
margin-top: 0px;
margin-right: 0px;
margin-bottom: 0px;
}
-->
</style>
<link href="StyleShee t.css" rel="stylesheet " type="text/css" />
<style type="text/css">
<!--
a:link {
color: #919297;
text-decoration: none;
}
a:visited {
text-decoration: none;
color: #919297;
}
a:hover {
text-decoration: none;
color: #cc6600;
}
a:active {
text-decoration: none;
color: #cc6600;
}
</style>
<?php
$path_to_images = "Images\Adverts \"; // path to your images
$default_img = "highrise.j pg"; // image to display if directory listing
fails

function getRandomImage( $path, $img) {
if ( $list = getImagesList($ path) ) {
mt_srand( (double)microti me() * 1000000 );
$num = array_rand($lis t);
$img = $list[$num];
}
return $path . $img;
}

function getImagesList($ path) {
$ctr = 0;
if ( $img_dir = @opendir($path) ) {
while ( false !== ($img_file = readdir($img_di r)) ) {
// can add checks for other image file types here
if ( preg_match("/(\.gif|\.jpg)$/", $img_file) ) {
$images[$ctr] = $img_file;
$ctr++;
}
}
closedir($img_d ir);
return $images;
}
return false;
}
?>
</Head>

<td width="590" height="22">
<img src="<?php echo getRandomImage( $path_to_images , $default_img) ?>"
alt="">
</td>

I have removed most of the HTML so as to minimise the thread.

Hope this makes some sence!

Regards,
Anthony

Oct 15 '06 #1
1 1986
Lee
nu************* **@hotmail.com said:
>
Hi there,

I am trying to include some javascript in my website which rotates some
stored images. I have attached the code for the index page of my
website as i am having some problems getting it to work. Can anyone see
where i am going wrong? This is my first attempt.

Here is the source script:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dt d">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"
/>
<title>??</title>
<style type="text/css">
<!--
body {
background-color: #006699;
margin-left: 0px;
margin-top: 0px;
margin-right: 0px;
margin-bottom: 0px;
}
-->
</style>
<link href="StyleShee t.css" rel="stylesheet " type="text/css" />
<style type="text/css">
<!--
a:link {
color: #919297;
text-decoration: none;
}
a:visited {
text-decoration: none;
color: #919297;
}
a:hover {
text-decoration: none;
color: #cc6600;
}
a:active {
text-decoration: none;
color: #cc6600;
}
</style>
<?php
$path_to_image s = "Images\Adverts \"; // path to your images
$default_img = "highrise.j pg"; // image to display if directory listing
fails

function getRandomImage( $path, $img) {
if ( $list = getImagesList($ path) ) {
mt_srand( (double)microti me() * 1000000 );
$num = array_rand($lis t);
$img = $list[$num];
}
return $path . $img;
}

function getImagesList($ path) {
$ctr = 0;
if ( $img_dir = @opendir($path) ) {
while ( false !== ($img_file = readdir($img_di r)) ) {
// can add checks for other image file types here
if ( preg_match("/(\.gif|\.jpg)$/", $img_file) ) {
$images[$ctr] = $img_file;
$ctr++;
}
}
closedir($img_ dir);
return $images;
}
return false;
}
?>
</Head>

<td width="590" height="22">
<img src="<?php echo getRandomImage( $path_to_images , $default_img) ?>"
alt="">
</td>

I have removed most of the HTML so as to minimise the thread.
You also seem to have removed all of the Javascript.
All I see is PHP.
--

Oct 15 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
4097
by: Deepa | last post by:
Hi All, I'm facing problem displaying image of size 5000X5000 .My window size is smaller than image size so i'm not able to see the complete image.i can use scroll bars to view the image but i need to rotate the image and the see the result everytime. For this my boss has given me suggestion to display only 20% of the image on window ,and rotation has to be applied to original copy.
2
1990
by: Andreas Viklund via DotNetMonster.com | last post by:
Hi! I am developing an application in ASP.NET that takes an image, that have been created with a digital camera or camera phone, and processes it, to get data from it. The image taken by the user will be of a square in some kind of magazine or newpaper, with a white background and the border of the square should be black. What I am trying to do is to find the square, or the corners of the square, in the image, using ASP.NET code. If the...
8
3681
by: chrisdude911 | last post by:
how do i add video into a javascript web page with my own custom buttons?
3
2307
by: Mark Szlazak | last post by:
The following page simulates a pool cue and cue ball: http://members.aol.com/myscript/cue.html Mouse cursor position around the cue ball determines where a roll-over of 179 pool cue images is placed around the ball and which one of those images is displayed. Each pool cue image is in a slightly different orientation and the correct one is chosen to match the orientation of the cursor around the ball. Holding down the left mouse button...
8
4319
by: RomanRusso | last post by:
Hie everybody, Here at this forum I have found something what I was looking for - rotation of cells in html table, here is the link http://www.thescripts.com/forum/threadnav149304-2-10.html The gue named RobD posted a nice script there. You can easily modify it for the needs of your table, but one problem occured on my way, maybe somebody can help. For instance if there is <a> tags inside one table cell, the script willl rotate only the...
5
2554
by: Ricardo Furtado | last post by:
I'm trying, for a week or two, to create a procedure in order to rotate the image in any picturebox control in a cephalometry software. I've found a web site that shows how that can be done: http://vb-helper.com/index_vbnet.html but the problem is that the image doesn't stay at the top, instead, the image is created upon another bitmap, even larger, and at its right corner. I've already tryed to cut the right corner, with the right...
3
5968
by: avalence | last post by:
Hello, I am trying to create a nice rotating earth globe (on mouse) on my web site, in order to display my professional relationships all over the world. The best way seems to be a javascript. In fact I still hesitate between java and javascript. My question is how can I create a interacting globe using a satellite photo. This is a very usefull applet for everybody. All suggestion welcome! Thanks Arnaud
3
3290
by: kimiraikkonen | last post by:
Hi, Here is a very interesting issue, Assume i have picturebox and loaded a image into picturebox, however whenever i want to rotate image using: 'For example 90 degree PictureBox1.Image.RotateFlip(RotateFlipType.Rotate90FlipX) This rotation takes effect on picturebox after i minimize - remaximize form OR after i drag form somewhere outside the screen the re-bring to
8
9436
by: infoseekar | last post by:
Image Resize & Rotation Hi I have 2 scripts, one for Image rotation and other image resize and they both are working. Image resize scripts load the picture and resize it and Image rotation rotate the image by 90 deg. They are two differennt files i.e. resize.php and rotate.php. What I want to do is to combine both rotate.php & resize.php files, so when the script resized the image than it will call rotate script to rotate the...
0
9716
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9595
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10604
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10359
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9177
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7643
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6870
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5675
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
3005
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.