kevin wood 29 Posting Whiz
$query = "SELECT random1 FROM random_number";
$result=mysql_query($query);

while($row=mysql_fetch_array($result)){
$rand="{$row['random1']}";
}

$image = "";
$broad_img1= "";
$path= 'http://www.acmeart.co.uk/mercury/';
$web_image_folder = 'image/thumbs';
$exts = array('jpg', 'png', 'gif', 'jpeg');
$image_name = 'thumb_image1';


// check for each extension
foreach($exts as $ext) {
   if (file_exists($web_image_folder.'/'.$image_name.'.'.$ext . $rand)) {
     $image = $image_name.'.'.$ext . $rand;
   } 
   
}


// check if we have an image
if ($image != "") {
    // ok we have the image
    $broad_img1='<img src="' . $path."/".$web_image_folder."/".$image . $rand'" />'; 
} else {
    // error, we can't find the image.
}

the image will not display, will the $rand variable still hold the value set from the mysql query.

kevin wood 29 Posting Whiz

i have store an image on the server from a file upload with a random number attached to it. i have then stored the random number in a mysql db for use on other pages to display the images.

the problem i am having is that the image will not display on other pages when i try to recall it from the server.

i have stored the image in a folder on the server using this code

"image/thumbs/thumb_".$image_name . $rand;

$image_name being the name of the file to be stored and $rand being the random number. i have then stored the random number in the db using

$rand= rand(0, 100);
$sql="INSERT INTO random_number (random1) VALUES ('$rand')";
$query = mysql_query($sql);

to get the file from the server to be displayed the code i have used is this

$image = "";
$broad_img1= "";
$path= 'http://www.acmeart.co.uk/mercury/';
$web_image_folder = 'image/thumbs';
$exts = array('jpg', 'png', 'gif', 'jpeg');
$image_name = 'thumb_image1';


// check for each extension
foreach($exts as $ext) {
   if (file_exists($web_image_folder.'/'.$image_name.'.'.$ext . $rand)) {
     $image = $image_name.'.'.$ext . $rand;
   } 
   
}


// check if we have an image
if ($image != "") {
    // ok we have the image
    $broad_img1='<img src="' . $path."/".$web_image_folder."/".$image . '" />'; 
} else {
    // error, we can't find the image.
}

this code worked fine before i was adding the random number. it retrieved the image and displayed the cached version (when cached cleared displayed new upload image).

i have got the random number …

kevin wood 29 Posting Whiz
$image=$_FILES['broad1_image']['name'];
 	// if it is not empty
 	if ($image) 
 	{
 		// get the original name of the file from the clients machine
 		$filename = stripslashes($_FILES['broad1_image']['name']);
 		
 		// get the extension of the file in a lower case format
 	 	$extension = getExtension($filename);
 		$extension = strtolower($extension);
 		// if it is not a known extension, we will suppose it is an error, print an error message 
 		//and will not upload the file, otherwise we continue
 		if (($extension != "jpg")  && ($extension != "jpeg") && ($extension != "png") && ($extension != "gif"))	
 		{
 			echo '<h1>Unknown extension!</h1>';
 			$errors=1;
 		}
 		else
 		{
 			// get the size of the image in bytes
 			// $_FILES[\'image\'][\'tmp_name\'] is the temporary filename of the file in which 
			//the uploaded file was stored on the server
 			$size=getimagesize($_FILES['broad1_image']['tmp_name']);
 			$sizekb=filesize($_FILES['broad1_image']['tmp_name']);

 			//compare the size with the maxim size we defined and print error if bigger
 			if ($sizekb > MAX_SIZE*1024)
 			{
 				echo '<h1>You have exceeded the size limit!</h1>';
 				$errors=1;
 			}


  			//we will give an unique name, for example the time in unix time format
 			$image_name=image1.'.'.$extension;
 			//the new name will be containing the full path where will be stored change these to the file where you would like to store the images.  (images folder)
 		 	$broad1name="image/".$image_name;
 		 	$broad1name2="image/thumbs/thumb_".$image_name . $rand;
 			$copied = copy($_FILES['broad1_image']['tmp_name'], $broad1name);
 			$copied = copy($_FILES['broad1_image']['tmp_name'], $broad1name2);
 			//we verify if the image has been uploaded, and print error instead
 			if (!$copied) {
 				echo '<h1>Copy unsuccessfull!</h1>';
 				$errors=1;
 			}
 			else
 			{
 				// the new thumbnail image will be placed in images/thumbs/ folder
 				$thumb_name=$broad1name2;
 				// call the function that will create the …
kevin wood 29 Posting Whiz

thank you for the reply

kevin wood 29 Posting Whiz

i am storing the number in a mysql db and then getting the number out of the db and appending it to the image on the different pages the images are used.

kevin wood 29 Posting Whiz

i have used a different solution now, still not got that working fully yet.

if someone could send me a link with a good explanation of the above code though that would be great as it is always nice to know how things work when you aint seen them before.

kevin wood 29 Posting Whiz

the code i have used does set the value of the variable to equal the number that is stored in the db.

would this variable then be able to be used in other parts of the page to then display the variable or is this only available to the mysql query. If i not being clear enough please say and i will try to explain better what i mean.

kevin wood 29 Posting Whiz

once the result from the mysql query has been set to be the value of the variable $rand would this then be available for use throughout this page?

kevin wood 29 Posting Whiz

i have created a table to store a random number in and now i need the number that has been stored in the db to equal a variable on the new page.

to get the information out of the db i have used this code

$query = "SELECT random1 FROM random_number";
$result=mysql_query($query);

while($row=mysql_fetch_array($result)){
echo "number is{$row['random1']}";
}

if i wanted the data in the row to set the variable to equl the same number would i write at the bottom instead of of the echo

$rand={$row['random1']};
kevin wood 29 Posting Whiz

from my research i think i am beginning to understand this code a bit more but if someone knows if i am wrong please tell me.

as it is asking for the element by name then the number in the [] is not needed as this is the elements id number in the array. So as i have put the name rand in it will already know which element i want to post.

the next part is what i am still struggling to understand. It has the =value section and this is where i am stuck. the value in this section i think must have something to do with where the information is being posted to but as the the page were i found this code did not explain things to greatly i am lost.

please someone explain this code to me or point me in the right direction of were to find a good example and explanation of the code so i can then try to implement the code on to my site.

kevin wood 29 Posting Whiz

that is sort of what i have working now but the problem with this method is that i am storing my images on the server and for me to be able to display the image again i must know what the appended number will be for me to be able to display the image again.

if it was possible to store the image like myimage.gif and when it came to display the image then have it as myimage.gif.1234 so that when the image was cached i it should be cahced with the number attached to it.

the more i think about it and the more i research it the more i am starting to thing that this will not work.

kevin wood 29 Posting Whiz

i have created a page which has an iframe held on it i now what to post the data from this iframe and make it available to my other php page. I have researched this a bit and found out it can be done using javascript. the code i have found is this.

<script type="text/javascript">
document.getElementsByName('rand')[0].value = document.getElementsByName('main')[0].src;
</script>

i am not to up on javascript so a little help is needed with this. i know the first element is the name of the hidden input i want to post, were i loose understanding is the next element name. is this the name of the page that the information needs to be posted to or is this how it posts it to the page the iframe is held on (main being the name used for that).

kevin wood 29 Posting Whiz

i am using php to upload images onto the server and then they are being displayed on other pages around the site. the problem i am having is if the user changes the images that they have uploaded the old ones are displaying from the cache.

i would like to know if it is possible to get the image from the server and then add a random number to it so that the cached images will always have a different number appended to the end of the file when of the image when displayed.

i dont want the random number stored with the file i only want it to be used when the file is being displayed.

i have tried to store the image with the random number and then post the variable holding this number to other pages from the image upload form but this has not worked. the variable is not getting posted so i can only get the rest of the file name when i look at the image properties.

kevin wood 29 Posting Whiz

i have been looking at using $_SESSION but i keep finding conflicting information about it. I cannot use session_start() as it does not like some of the code on my pages. When researching the $_SESSION array it says in places that session_start must be used and in others says it can be used on its own and the variables will be available across the other pages.

do you know were i can find a good tutorial on this.

kevin wood 29 Posting Whiz

is it possible to generate a random number and then use cookies to pass this number to other page?

i cannot use session_start because it does not like my code for resizing the images that are uploaded and i cannot use get as the page the the random number is in a iframe and has no buttons on to append it to the url.

i have tried to post the data but had no joy the variable $rand has no value when checked on the next page. the code i used for the submit button looks like this

<form name="newad" method="post" enctype="multipart/form-data"  action="">
		<input type="hidden" method="<?=$rand;?>" name="rand" />
		<input type="file" name="broad1_image"  ></td></tr>
		<input name="Submit" type="submit" id="image1" value="Upload image" ></td></tr>
	
</form>

and the code i used to retrieve the value looks like this

$rand= $_POST['rand'];
kevin wood 29 Posting Whiz

sorry i took so long gettin back i have been away from the comp. what code would you like me to upload.

kevin wood 29 Posting Whiz

i have a problem about sending variables through to other pages. I have done this before using forms to post the variables. I have tried to use the SESSION_START () function but that does not like the code i have used for the image resize on the page.

i have added a random number to an image so that if a new image is uploaded it cannont show the old images as the file will never have the same path.

what i need to know is what is the best way to get the variable on to the next page. I was looking at the $_GET function to add the variable to the url but the upload takes place in an iframe so this cannot be done.

what ither ways are left as i have exhausted my knowledge of passing this variable on. I have had a look at cookies but not sure if they can be used.

kevin wood 29 Posting Whiz

if i am to store the image with a random number attached to it then could i post the number on the submit button and retrieve it on the next page. would the code look something like this

$rand= rand(1, 100);

to display the image on the upload page

$thumb_name=$broad1name2 . $rand;

to post the random number to the next page on the submit button

<form name="newad" method="post" enctype="multipart/form-data"  action="">
		<input type="hidden" method="post" name="rand" />
		<input type="file" name="broad1_image"  ></td></tr>
		<input name="Submit" type="submit" id="image1" value="Upload image" ></td></tr>
	
</form>

and to retrieve the random number on the next page

$rand=$_POST['rand']

that way the number would be the same if the code is correct

kevin wood 29 Posting Whiz

i am storing the files on the server so that they can be recalled when the email is sent out with the images held within it. the reason i want to add the random number after they have been stored is because the images are being cached.

the problem with the images getting cached is if the user comes and uploads a new image with the same file extension it will only show the cached version of the image. i have tried to stop the images getting cached with various different methods which in clude php headers and html meta tags, both methods failed.

so my next attempt at trying to get it show the new images is by adding a random number. if i store the number with the file i have no way of knowing the full path to the file once a random number has been added to it.

i tried a method were the random number that was generated was sent to the other pages with the session_start() function but that through up a load of errors with my code that is working fine without that in.

if i can get it to find the image without the random number attached to it then add this i am hoping this will stop the old images from being displayed on the pages. I know it is a problem with the images being cached because each time the upload page is entered it unlinks …

kevin wood 29 Posting Whiz

so would it be possible use the if file exists to retrieve the file and then on each individual page add a unique random number to each image so that they all have there own number attached to them.

kevin wood 29 Posting Whiz

is it possible to a random number to a image file without it becoming a part of that file name. what i want to do is where i am displaying the image add a random number so that the image when cached has this number attached to it but it is not part of the path to the file.

so i want it to be displayed by getting the file name then adding the number so that the number changes every time the page is viewed and the image cannot be displayed from the cach

kevin wood 29 Posting Whiz

the images are being cached on the server i think and this why the same images show up on the emails i think. i am working on adding a random number to the image when it is uploaded and then using the post/get method to retrieve the value of the random number to use to display the image.

if a random number is added to the image then the image that is shown on the email page will always have a different value added to it so it should always show the new images that are uploaded.

well that is the theory behind it anyway weather it works or not is another thing.

kevin wood 29 Posting Whiz

i have tried that and had no joy. i checked on the server to see if it was a problem with the unlink code i have but it is defiantly uploading the images and removing the old files on the server. I know this as the time stamps for when the file was uploaded are changing.

i will have a good search around the web and see what i can find i will post it here if i find anything that works.

kevin wood 29 Posting Whiz

i have created a website where the user is able to upload images and then they are displayed on and email which is then sent out to the people of there choice.

the problem i am getting is that the images are being cached and then the new images are not displaying.

i have used if file exist to display the images on the email and also used it to unlink the files once they have been used. When the user comes to use the system next time if they upload an image of the same file type then it is displaying the cached version and not the new image. if a image with a different file type is uploaded then it works, but this will only show different images as long as the file type has not been used.

i have tried using this

<META HTTP-EQUIV="Pragma" CONTENT="no-cache">
<META HTTP-EQUIV="Cache-Control" CONTENT="no-cache">

which has had no effect on the situation. i put the above code inside the head tag is this the correct place to put it. the reason i put it there is because this is usually were the meta tags are placed.

kevin wood 29 Posting Whiz

thanks for your help robothy (sorry if spelt wrong) if you ever need any help with anythin i will do my best to help. i am not the best but i do know bits.

kevin wood 29 Posting Whiz

we must have got on to that at the same time i was just about to put this up when i seen your reply. thanks. i have got the code to work now i modified it so it now looks like this

<?php
$path='image/thumbs/';
$fileToRemove1 = 'thumb_image1';
$exts = array('jpg', 'png', 'gif', 'jpeg');				

foreach($exts as $ext) {

   if (file_exists($path.'/'.$fileToRemove1.'.'.$ext)) 
     {
     unlink($path.'/'.$fileToRemove1.'.'.$ext);
	 }
   	}
?>

i have moved the code on to its own page and used the include once function and it works fine it removes the file.

the problem now is the cache it is displaying old images instead of the new ones that have been uploaded. i found this code to stop the caching of the images but it has not seemed to work

<META HTTP-EQUIV="Pragma" CONTENT="no-cache">
<META HTTP-EQUIV="Cache-Control" CONTENT="no-cache">
kevin wood 29 Posting Whiz

sorry about the stupid text above i didnt think it would come out like that the warring reads Warning: unlink(thumb_image1): No such file or directory in /home/acmeart/public_html/mercury/upload.php on line 28 the directory the images are in is images/thumbs and my code now looks like

$path='image/thumbs/';
$fileToRemove1 = 'thumb_image1';
$exts = array('jpg', 'png', 'gif', 'jpeg');				

foreach($exts as $ext) {

   if (file_exists($path.'/'.$fileToRemove1.'.'.$ext)) 
     {
     unlink($fileToRemove1);
	 }
   	}
kevin wood 29 Posting Whiz

i have edited the code slightly and am getting a different error. it is now saying

[TEX]Warning: unlink(thumb_image1): No such file or directory in /home/acmeart/public_html/mercury/upload.php on line 28[/TEX]

please correct me if i am wrong but to me it looks like it is trying to delete a file from the wrong place. the file i want removed is in the directory

[TEX]image/thumbs[/TEX]

the warning looks to me if it is lokking for the image in the [TEX]mercury/[/TEX] directory on the server.

kevin wood 29 Posting Whiz

Nav33n

sorry bout the spelling mistake on your name i was just talking to someone about sat navs.

it has given me the error message Warning: chmod(): No such file or directory in /home/acmeart/public_html/mercury/upload.php on line 28 Warning: unlink(image/thumbs/thumb_image1): No such file or directory in

kevin wood 29 Posting Whiz

robothy

the page that is sent out in an email is a html page which has some dynamic elements added to it. the images are being sent now. the part which aint workin in the unlink side of it the files that are uploaded stay there unless i physically go on to the server and delete them myself.

Navman33

thank for the hint i will go and check that out now and see what is happening.

kevin wood 29 Posting Whiz

i have got the images coming through with the email. :icon_smile: the code now looks like this

$image = "";
$broad_img1= "";
$path= 'http://www.acmeart.co.uk/mercury';
$web_image_folder = 'image/thumbs';
$exts = array('jpg', 'png', 'gif', 'jpeg');
$image_name = 'thumb_image1';


// check for each extension
foreach($exts as $ext) {
   if (file_exists($web_image_folder.'/'.$image_name.'.'.$ext)) {
     $image = $image_name.'.'.$ext;
   }
}

// check if we have an image
if ($image != "") {
    // ok we have the image
    $broad_img1='<img src="' . $path."/".$web_image_folder."/".$image . '" />';
} else {
    // error, we can't find the image.
}

but i have now worked out i dont think my file unlink is working my code for this is this

$fileToRemove1 = 'image/thumbs/thumb_image1';
$exts = array('jpg', 'png', 'gif', 'jpeg');				

foreach($exts as $ext) {

   if (file_exists($fileToRemove1.'.'.$ext)) 
     {
        @chmod(0777, $fileToRemove1.'.'.$ext);
     }
     @unlink($fileToRemove1);
   }
kevin wood 29 Posting Whiz

robothy

thanks for the reply i will try that and see if that has any effect on the outcome.

amigura

since the images will be sent out as part of an email i need the absolute path with them. so for the if file exists section if i use relative paths there that would work. when it comes to displaying them could i write something like

'http://www.acmeart.co.uk."/". $web_image_folder."/".$image . '

would that code work i will try it anyway but if it is wrong can you please show me where i went wrong.

kevin wood 29 Posting Whiz

thought as much that didnt work. is it possible to do what i need it to

kevin wood 29 Posting Whiz

i may be clutching at straws but could it be i have put the if file exists function. i will move this so it is inside the message variable and see if that changes the outcome.

kevin wood 29 Posting Whiz

sorry about that just been having ago at the Norton consultants. they want £70 to remove a virus when i have already paid for my license cheeky bast***s. here is all the code for the send email page.

<?
// You may copy this PHP section to the top of file which needs to access after login.
session_start(); // Use session variable on this page. This function must put on the top of page.
if(!session_is_registered("first_name")){ // if session variable "username" does not exist.
header("location:index.php"); // Re-direct to index.php
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Mercury v1.0 | Admin System</title>
<link href="includes/global.css" rel="stylesheet" type="text/css" />
<style type="text/css">
<!--
.mainTxt {font-size: 11px; color:#444444; font-family: Arial, Helvetica, sans;}
.style1 {
	font-family: Arial, Helvetica, sans-serif;
	font-size: 10px;
	color: #666666;
}
.logout {
	position: fixed;
	width: 50px;
	height: 25px;
	left: 801px;
	top: 57px;
	padding: 0px;
	z-index: 100;
}
* html .logout {
	position: absolute;
top:expression(eval(document.compatMode &&
document.compatMode=='CSS1Compat') ?
documentElement.scrollTop : document.body.scrollTop);
	top: 57px;
	}
.register {
	position: fixed;
	width: 110px;
	height: 25px;
	left: 801px;
	top: 5px;
	padding: 0px;
	z-index: 100;
	font-family: Arial, Helvetica, sans-serif;
	font-size: 10px;
	color: #333333;
}
* html .register {
	position: absolute;
top:expression(eval(document.compatMode &&
document.compatMode=='CSS1Compat') ?
documentElement.scrollTop : document.body.scrollTop);
	top: 4px;
	}
-->
</style>
<link href="includes/admin.css" rel="stylesheet" type="text/css" />
<style type="text/css">
<!--
body {
	background-image: url(admin/images/yrepeat.gif);
}
-->
</style></head>


<body>
<div class="register"> To register another user to Mercury &copy; &reg;<br />
    click <a href="join_form.php">here</a> <br/>
</div> …
kevin wood 29 Posting Whiz

the images are there weather it is finding them is another question i would need to put in some echo "file found" along the way to see that. but if you can not see a problem with that code then they must be getting found just not getting displayed.

as the images will be sent out in a email the absolute path to them must be used when displaying them. for the file exist part could the image file along with the extension be found using relative paths. would this section work if the relative paths where used.

when it comes to display the image then the absolute path would have be used to displayed the image as it is being sent out in an email.

the file extensions can only ever be gif, jpeg or png files, it there another way you know of i could get the image to display in the email.

i can upload the page which is to be sent out if that would make this problem clearer for you.

kevin wood 29 Posting Whiz

i am trying to get an image file to display in an email, the file is stored on the server but it will not send the file with the email. i have been working on this code now for a few days and i cannot get it to work.

the files that i need displaying change so i have incorporated an array to get the file extension, the email is sent with all the text and images which have been coded in using the absolute file path but the images i want to get from the if file exists function will no show.

here is the code for the file exist if anyone can see why this is not working please show me.

$image = "";
$web_image_folder = 'http://www.acmeart.co.uk/mercury/image/thumbs';
$exts = array('jpg', 'png', 'gif', 'jpeg');
$image_name = 'thumb_image1';


// check for each extension
foreach($exts as $ext) {
   if (file_exists($web_image_folder.'/'.$image_name.'.'.$ext)) {
     $image = $image_name.'.'.$ext;
   }
}

// check if we have an image
if ($image != "") {
    // ok we have the image
    $broad_img1='<img src="' . $web_image_folder."/".$image . '" />';
} else {
    // error, we can't find the image.
}
kevin wood 29 Posting Whiz

that luck as still not come my way.:(

kevin wood 29 Posting Whiz

i have now removed the bottom half of the code and move the some of it to the top part of the code. it now looks like this:

$image = false;
$web_image_folder = 'http://www.acmeart.co.uk/mercury/image/thumbs';
$exts = array('jpg', 'png', 'gif', 'jpeg');
$image_name = 'thumb_image1.'.'.$exts';


// check for each extension
foreach($exts as $ext) {
   if (file_exists($web_image_folder.'/'.$image_name.'.'.$ext)) {
     $image = $image_name.'.'.$ext;
   }
}

the code is still not working though.

the reason i changed the code to your post is because the email message that i am sending has already been coded at the bottom of the page so all i need to do is add the images inside the body in the correct places.

with a bit of luck it will be working soon enough.

kevin wood 29 Posting Whiz

i have changed the code a bit to suit how i needed it to work but it is not displaying the images on the page. i may have messed the code up. if you can see a problem please point this out.

$image = false;
$exts = array('jpg', 'png', 'gif', 'jpeg');
$image_name = thumb_image1.'.'.$exts;


// check for each extension
foreach($exts as $ext) {
   if (file_exists($image_name.'.'.$ext)) {
     $image = $image_name.'.'.$ext;
   }
}

// check if we have an image
if ($image) {
// ok we have the image
$web_image_folder = 'http://www.acmeart.co.uk/mercury/image/thumbs';

} else {
// error, we can't find the image.
}

the code i have used to display the image inside the body of the email looks like this:

<img src=".$web_image_folder.'/'.$image." />
kevin wood 29 Posting Whiz

completed this task with iframes. getting the information need to load in to an iframe form the click of a button from the flash menu.

kevin wood 29 Posting Whiz

i ended up getting it work using iframes, i no it is not the same but it works.

i set the i frames to load different images in from a button click in the menu. it works fine and has no effect on the page loading times.

kevin wood 29 Posting Whiz

thanks for that reply it looks like i will be able to get it work from that code you gave me. sorry it took so long for the reply i have been working on something different today.

kevin wood 29 Posting Whiz

as it was only a couple of images i got round it by just creating a web page wih a one cell table on it and displaying the image in there. then with the iframe i just called the web page holding the image and it displayed it fine.

probably another way to do it but it only took me a couple of minutes to create the pages i needed thanks for the reply though.

explanation of how i worked through the problem:

my problem was i needed to display an image inside an iframe, when the image was displayed in the iframe using the img tag the image was resized and was barely visible.

solution

create a web page which has a one cell table the same size as the image you need displaying. insert the image into the table cell with the image tag. save this page with what ever name you like.

on the page where you want the image to be displayed in the iframe, instead of calling the image directly into the iframe call the page you have created with the image in the table.

set the ifame to be slightly bigger than the table cell and set the scrolling to no.

the image should now be displayed in the iframe keeping all its original attributes.

kevin wood 29 Posting Whiz

still cannot get any code to work anyone know of any way to get the images to swap when the page is loaded. everything i have tried has failed up to i will keep trying though.

kevin wood 29 Posting Whiz

i ahve changed the code but it still is not working the code i have now looks like this

function changeImage() {
if (document.getElementById) {
document.getElementById("image").style.background="images/home_title.jpg";
}
else if (document.all) {
document.all["image"].style.background="images/home_title.jpg";
}
else if (document.layers) {
document.layers["image"].style.background="images/home_title.jpg";
}
}

in the body tag

onload="changeImage()"

and were the image is displayed

<td height="24"  colspan="2" id="image" background="images/commissioning_title.jpg"></td>

i will kep looking for the solution if i find it i will post it. if anyone knows were to find the solution please post the address here.

kevin wood 29 Posting Whiz

i am trying to write a function so that when a user enters onto a page selected images change with each page that is entered. the page uses an iframe to load the new data so i need to swap the images on the main page which holds the iframe inside it.

function swap_image{
    document['imgMain'].src = title_commissioning.jpg;
  }

in the body of the page

onload="swap_image"

would the code look something like the code above or would it need to be expanded because the images that are being change are not in the iframe.

kevin wood 29 Posting Whiz

i have an i frame on my page and when a button is clicked it loads the title for that page into the iframe. the problem i am having is when the image is loaded into the iframe it reduces the size of the image. how can i get it to display the image without changing the size of it the code i have used looks like this

<iframe name="ifrm" id="ifrm2" src="images/home_title.jpg" scrolling="no" allowtransparency="true" ></iframe>
kevin wood 29 Posting Whiz

does anyone no any code that can be attached to a flash button so that it finds and replaces images within a html page.

there is a page on the web which looks like it might tell you how to do it but i just keep getting database error when the page tries to load. never had that one before anyway.

if someone who knows where else to find this it would be nice to point me in the right direction.

kevin wood 29 Posting Whiz

this code does work it just needs uploading first? why who knows i dont