kevin wood 29 Posting Whiz

that code does work it just needs to be uploaded on to a server before it will work. why this has to be done i dont no but i guess that is computers for you.

kevin wood 29 Posting Whiz

i have already completed the site and to set it up with framesets would be to time consuming. thanks for the reply though. i have nearly worked it out using iframes and the flash menu. the content will not open up in the iframe it just keeps on opening up in a new window.


the code i have used is

on (release){
getURL("commissioning/index1.htm" , "ifrm");

}

does anyone no why this aint working

kevin wood 29 Posting Whiz

i am working with a flash menu and would like it load content into an iframe using the button from the menu.

i have had a look around and found this code

on (release){
getURL("commissioning/index1.htm" , "ifrm");

}

this is meant to load the new content into the iframe but it just opens it in a new window has anybody done this before? does anyone no why this code is not working i have tried it without the quote marks around the frame id and it still has the same effect.

kevin wood 29 Posting Whiz

if i use iframes this will stop the menu and the title reloading each time the page is entered. how can i set this up though i have used iframes to display information before but i have not used them to link in with the navigation buttons.

kevin wood 29 Posting Whiz

the image extension are saved with the images. if the file_exists is used and the file is set to the variable how should the img tag be written to display this image. i have written it like this

<img src=$filename>

as i am already using php to send the html out as an email i cannot use the echo function as it will not work inside the body of the message and i think it would not be sent any way as it is using php to display the image and only html can be sent in the body of the email.

at the top of the send mail page were the body is created i have entered the file_exists code so that when the file is sent the path to the file is held on this page and the variable will always hold a value.

kevin wood 29 Posting Whiz

i no once the have been loaded once they are cached but even when the flash menu has been cached it still takes a long time for the menu to load up. all the other objects on the page just flicker which i can live with but the menu takes a couple of seconds to load which is not so good. this is why i was looking at loading the other pages using iframes or xmlhttprequests.

kevin wood 29 Posting Whiz

thanks for the replay i think it is working now i is just having a bit of trouble displying the images on the sent email.

as the images can have different extensions at the end. when i come to display the image using the html img tag with the path to the file the extension must be correct for it to display.

the code i have used to display the image looks like this

<img src=http://acmeart.co.uk/mercury/image/thumbs/thumb_image2.gif>

but because it has .gif on the end it will not work if a jpg or png is uploaded. i could fix it by only letting .gif be uploaded but this would not be useful for the user.

is there away of concatenating the file extensions so that it can select which one it needs to look for.

i have used php before to work through file extension until it finds the one it needs to display but as the email must be straight html how can this be done.

kevin wood 29 Posting Whiz

thanks for the reply it was really helpful i will have a look minifying the code and the xmlhttprequest. I have used this on another project before just not in this way.

kevin wood 29 Posting Whiz

thanks for the reply for this and for the php question earlier that is working it looks like anyway just got to do some more test in the morning.

i did mean cached sorry. on the home page i have proloaded all the images and the menu into the cache but it has no effect on the menu. once all the pages have been loaded once the menu shows up pretty quickly but the first time they are entered it takes sometimes a long time for them to load.

if i used an iframe with no size could an loaded the other pages into this on the home page without it having any large effect on the loading time of the page.

kevin wood 29 Posting Whiz

i have changed the code now so that it uses the path to the iage but the problem i am having now is that if the file extension is not the same then it will not overwrite the image. how can i get it to delete the image no matter if it is jpg, gif, png.

the code i am using now looks like this i have added a bit to delete both copies of the image (original and thumbnail).

$fileToRemove = '/home/acme/public_html/image/thumbs/thumb_image1';
				if (file_exists($fileToRemove)) {
   					// yes the file does exist
  					 unlink($fileToRemove);
				} else {
   						// the file is not found, do something about it???
				}
				
				$fileToRemove = '/home/acme/public_html/image/image1';
				if (file_exists($fileToRemove)) {
   					// yes the file does exist
  					 unlink($fileToRemove);
				} else {
   						// the file is not found, do something about it???
				}

i need some code to go on the end of the filetoremove line to it checks for all file extension or just delets it by name without the extionsion getting looked at.

kevin wood 29 Posting Whiz

i have done little bit of research on this but all the information i could find was about unlinking text file i need to unlink an image.

i have a variable which store the path to an image stored in file on the server which is what i am trying to unlink. the code i have used id this

unlink($broad1name2);

and the code which stores the path to the image looks like this

$broad1name2="image/thumbs/thumb_".$image_name;

when i run the code i get the error message

Warning: unlink(): No such file or directory in /home/acmeart/public_html/mercury/upload.php

i have never used the unlink() function before and would like it if someone who has used it or knows how to use it to show me were i am going wrong.

are you able to use a variable to unlink a file?

kevin wood 29 Posting Whiz

thanks for the reply i should get it working now.

kevin wood 29 Posting Whiz

i have created a file uploading system on a website that i have created and i need to know how the file can be over written.

the file thats are upload are only used once and the next time the user uploads a new file i want the last file to be over written. the code i am using to name the file on the server is this.

$image_name=image1.'.'.$extension;

i no some a if statement will have to be placed in but when i tried to code it it stopped the upload working. i was using a unix time stamp at first but if i name the image it makes it easier for the image to be used in other sections of the site and for email purposes.

kevin wood 29 Posting Whiz

is there a script that will load the all the page objects before the next page is connected to.

i have a flash menu and i want it to load up on to the server and then not have to be reloaded every time a new page is entered/accessed.

kevin wood 29 Posting Whiz

i work for a company who develops websites and i have the great job of designing and developing the sites that we produce.

my of tackling it is to design the site first then add the functionality to it later. as for changing the design all the time this is going to happen i feel with any site that you under take as you will design something one way come in the next day after a brain wave the night before and change sections of it.

this is how i work but i feel it is probably down to the person who has the task in front of them as you only know yourself what you are most comfortable doing.

for instance if you find the coding harder then you may leave this to the end and vise versa it just depends on what which side of things you are better suited to.

kevin wood 29 Posting Whiz

i have done this before but cannot for the life of me remember how it is done. i have my title for my website which is a photoshop image and it is used on all the pages each time i go to a different page in the site it reloads the image and the flash menu.

how can i stop them from reloading each time the new page is accessed and only load the new content onto the page.

the only things that change on the new pages are the text inside the table and the title at the top of the table.

i know i could have done it using iframes and loading the new data for each page into an iframe but i have completed the site now and it would be easier to get the page to stop loading the same images twice.

kevin wood 29 Posting Whiz

i have recently left uni and wanted to go into the development side of things as i enjoy coding and working through problems (not always on my own daniweb helped a few times). i ended up getting job running all the websites for a company (on my own).

i would have originally classed myself as a developer but now i do web design, web development and multimedia development (flash, graphics, animation, 3d modeling).

what would i come under now?

kevin wood 29 Posting Whiz

most of the body is dynamically created from user inputs but the images are uploaded from an upload page then stored in an mysql database. only the relative path to the uploaded images is stored.

would it be possible to store the absolute path to the image in the database then use the include function in php to access the db and retrieve the images needed for the email.

surly this has been done before i cannot be the first person to try and send images from a mysql db in an email. :-(

kevin wood 29 Posting Whiz

thanks for the help.

kevin wood 29 Posting Whiz

this is were my problem lies though. i have been able to hard code images in to the html code and send this out as an email newsletter but when the images from the database are used they do not show up on the email.

i have set the page up once with all the images coded in using the img tag and it works i need to be able to recall the images from the database and send them out in the email with the absolute path attached to them so that when the email is opened it knows to look on the server were they are held to retrieve the image and display it correctly in the email.

kevin wood 29 Posting Whiz

yes that would work if the images where stored within the same folders as the website but as the images are being uploaded by the user and stored in the mysql data base.

i used php to get the path to the directory where the images are stored but how can i use this to display the images that held in the mysql db.

kevin wood 29 Posting Whiz

it is possible to display images in an email i have already got some of them to display on the email that is being sent out but none of the images from the databases will display within the email.

to gat images to display within the email then the absolute paths must be used for the images and they will display. to get an image to display using the absolute path the the code looks some thing like this

www.yourdomain.com/images/image1.jpg

i have used this code to get the absolute path of the images bing stored in the database

$path = getcwd();
echo "The absolute path to this directory is: ";
echo $path;

and this prints out the absolute path to the directory where the mysql table is stored i now need to know how to use this path to get the images to display from the server when the email is sent out.

kevin wood 29 Posting Whiz

i am trying to send out an email which contains images from a database of images that have been uploaded. when i send the email out only the text and any images that have been hard codeing in using the img tag.

i have done some research on this and i have found out that i need to display the images using the absolute path to them but i do not know how to do this.

i found some code to print out the absolute path to where the images is being dstored in the database but how do i then use this path to display the images within the email?

kevin wood 29 Posting Whiz

how can i get the mysql images to display in the newsletter?

how would i get the absolute path for these.

kevin wood 29 Posting Whiz

i have just found this code is there away of doing this which does not use so much code.

i mean i can use this but i would rather learn the code myself for future use. (that is if MSIE decide to sort out this problem before it is needed again)

here is the code it goes on its own php page and only searches for images with .png extension.

<?php
function replacePngTags($x,$img_path='',$sizeMeth='scale',$inScript=FALSE){
    $arr2=array();
    // make sure that we are only replacing for the Windows versions of Internet
    // Explorer 5.5+
    $msie='/msie\s(5\.[5-9]|[6]\.[0-9]*).*(win)/i';
    if( !isset($_SERVER['HTTP_USER_AGENT']) ||
        !preg_match($msie,$_SERVER['HTTP_USER_AGENT']) ||
        preg_match('/opera/i',$_SERVER['HTTP_USER_AGENT']))
        return $x;

    if($inScript){
        // first, I want to remove all scripts from the page...
        $saved_scripts=array();
        $placeholders=array();
        preg_match_all('`<script[^>]*>(.*)</script>`isU',$x,$scripts);
        for($i=0;$i<count($scripts[0]);$i++){
            $x=str_replace($scripts[0][$i],'replacePngTags_ScriptTag-'.$i,$x);
            $saved_scripts[]=$scripts[0][$i];
            $placeholders[]='replacePngTags_ScriptTag-'.$i;
        }
    }

    // find all the png images in backgrounds
    preg_match_all('/background-image:\s*url\(([\\"\\\']?)([^\)]+\.png)\1\);/Uis',$x,$background);
    for($i=0;$i<count($background[0]);$i++){
        // simply replace:
        //  "background-image: url('image.png');"
        // with:
        //  "filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(
        //      enabled=true, sizingMethod=scale, src='image.png');"
        // I don't think that the background-repeat styles will work with this...
        $x=str_replace($background[0][$i],'filter:progid:DXImageTransform.'.
                'Microsoft.AlphaImageLoader(enabled=true, sizingMethod='.$sizeMeth.
                ', src=\''.$background[2][$i].'\');',$x);
    }

    // find all the IMG tags with ".png" in them
    $pattern='/<(input|img)[^>]*src=([\\"\\\']?)([^>]*\.png)\2[^>]*>/i';
    preg_match_all($pattern,$x,$images);
    for($num_images=0;$num_images<count($images[0]);$num_images++){
        // for each found image pattern
        $original=$images[0][$num_images];
        $quote=$images[2][$num_images];
        $atts=''; $width=0; $height=0; $modified=$original;

        // We do this so that we can put our spacer.png image in the same
        // directory as the image - if a path wasn't passed to the function
        if(empty($img_path)){
            $tmp=split('[\\/]',$images[3][$num_images]);
            $this_img=array_pop($tmp);
            $img_path=join('/',$tmp);
            if(empty($img_path)){
                // this was a relative URI, image should be in this directory
                $tmp=split('[\\/]',$_SERVER['SCRIPT_NAME']);
                array_pop($tmp);    // trash the script name, we only want the directory name …
kevin wood 29 Posting Whiz

does anyone no how to make an image in IE transparent?

my images work fine in Netscape/Firefox but display with white backgrounds in IE?

kevin wood 29 Posting Whiz

thanks for the link.

kevin wood 29 Posting Whiz

i dont no what you mean by friendly urls?

kevin wood 29 Posting Whiz
ob_start();
  include "broad_prev.php";
  $message = ob_get_contents();
  ob_end_clean();

i have used the code above to get the contents of my php page to display in a newsletter thst is emailed out to the mailing list.

it works to apoint but no images are sent through with the email just the text. could this be a problem with how the images are stored on the page it is putting into the email.

the code for the page which is getting emailed looks like this

<body>
<?php
include"db.php";

$con = mysql_pconnect("$xxxxx","$xxxxx","$xxxxx") 
	or die ("QUERY ERROR: ".mysql_error());

$db = mysql_select_db($xxxxxx, $xxxxxx)
	or die("QUERY ERROR: ".mysql_error());
?>
<table width="900" border="0" align="center" cellpadding="0" cellspacing="5">
    <tr>
        <td height="95" colspan="2" scope="col"><img src="layout/BroadsheetSample/broadhead.jpg" width="900" height="150" /></td>
    </tr>
    <tr>
        <td height="25" colspan="2" scope="col"><span class="title"><?php echo ($broad_topictitle1); ?></span></td>
    </tr>
    <tr>
        <th width="23%" height="200" scope="col"><div align="left">
            <p>

					<?php
						
					$query = "SELECT broad1 FROM images_broad";
					$result=mysql_query($query);

					while($row=mysql_fetch_array($result, MYSQL_ASSOC)){
					echo '<img src="'.$row['broad1'].'"/>';
					}
						      
					?>
			
            <p>&nbsp;</p>
        </div></th>
        <td width="77%" scope="col"><table width="99%" border="0" cellpadding="10" cellspacing="0">
            <tr>
                <td align="left" valign="top"><span class="mainTxt"><?php echo  ($broad_messagebody1); ?></span></td>
                <!-- End Image 1 -->
            </tr>
        </table>
        <p>&nbsp;</p>
        <p>&nbsp;</p>
        <p>&nbsp;</p>
        <p>&nbsp;</p>
        <p>&nbsp;</p></td>
    </tr>
    <tr>
        <td height="28" colspan="2" scope="col"><span class="title"><?php echo ($broad_topictitle2); ?></span></td>
    </tr>
    <tr>
        <th height="95" scope="col"><div align="left">
            		<?php
						
					$query = "SELECT broad2 FROM images_broad";
					$result=mysql_query($query);

					while($row=mysql_fetch_array($result, MYSQL_ASSOC)){
					echo '<img src="'.$row['broad2'].'"/>';
					}
					
						      
					?>
            <p><br />
            </p>
        </div></th>
        <td scope="col"><table width="99%" border="0" cellpadding="10" cellspacing="0">
                <tr>
                    <td align="left" valign="top"><span class="mainTxt"><?php echo ($broad_messagebody2); ?></span></td>
                    <!-- End Image 1 -->
                </tr>
				
            </table>
                <p>&nbsp;</p>
                <p>&nbsp;</p>
                <p>&nbsp;</p>
                <p>&nbsp;</p>
                <p>&nbsp;</p></td>
    </tr>
    <tr>
        <td colspan="2" scope="col"><img src="layout/BroadsheetSample/broadfoot.jpg" width="900" height="150" …
kevin wood 29 Posting Whiz

does anyone no if it is possible to convert a php/mysql page into a html page?

if it is would it be possible for you to point me in the right direction as i have no joy searching the net.

kevin wood 29 Posting Whiz

is it possible to use the include function but set the included file to be the value of the variable $message if it can be done and it works they way i want it should send the contents of the page in the message as the variable message is sent as the message???

i might be wrong. (i do try tho)

the code in the post above only sends the semi colons through from the the end of the mysql statements on the preview page. nothing else is sent through.

kevin wood 29 Posting Whiz

the page i want to include in the email looks like this

<table width="900" border="0" align="center" cellpadding="0" cellspacing="5">
    <tr>
        <td height="95" colspan="2" scope="col"><img src="layout/BroadsheetSample/broadhead.jpg" width="900" height="150" /></td>
    </tr>
    <tr>
        <td height="25" colspan="2" scope="col"><span class="title"><?php echo ($broad_topictitle1); ?></span></td>
    </tr>
    <tr>
        <th width="23%" height="200" scope="col"><div align="left">
            <p>

					<?php
						
					$query = "SELECT broad1 FROM images_broad";
					$result=mysql_query($query);

					while($row=mysql_fetch_array($result, MYSQL_ASSOC)){
					echo '<img src="'.$row['broad1'].'"/>';
					}
						      
					?>
			
            <p>&nbsp;</p>
        </div></th>
        <td width="77%" scope="col"><table width="99%" border="0" cellpadding="10" cellspacing="0">
            <tr>
                <td align="left" valign="top"><span class="mainTxt"><?php echo  ($broad_messagebody1); ?></span></td>
                <!-- End Image 1 -->
            </tr>
        </table>
        <p>&nbsp;</p>
        <p>&nbsp;</p>
        <p>&nbsp;</p>
        <p>&nbsp;</p>
        <p>&nbsp;</p></td>
    </tr>
    <tr>
        <td height="28" colspan="2" scope="col"><span class="title"><?php echo ($broad_topictitle2); ?></span></td>
    </tr>
    <tr>
        <th height="95" scope="col"><div align="left">
            		<?php
						
					$query = "SELECT broad2 FROM images_broad";
					$result=mysql_query($query);

					while($row=mysql_fetch_array($result, MYSQL_ASSOC)){
					echo '<img src="'.$row['broad2'].'"/>';
					}
					
						      
					?>
            <p><br />
            </p>
        </div></th>
        <td scope="col"><table width="99%" border="0" cellpadding="10" cellspacing="0">
                <tr>
                    <td align="left" valign="top"><span class="mainTxt"><?php echo ($broad_messagebody2); ?></span></td>
                    <!-- End Image 1 -->
                </tr>
				
            </table>
                <p>&nbsp;</p>
                <p>&nbsp;</p>
                <p>&nbsp;</p>
                <p>&nbsp;</p>
                <p>&nbsp;</p></td>
    </tr>
    <tr>
        <td colspan="2" scope="col"><img src="layout/BroadsheetSample/broadfoot.jpg" width="900" height="150" /></td>
    </tr>
    
    <tr>
        <td height="13" colspan="2" scope="col"><div align="justify"><span class="style1">Linacre Voice is a monthly bulletin from LinacreOne Community Partnership 140-142 Linacre Road Litherland L21 8JU Tel: (0151) 922 4898 Open Monday - Thursday 10:00am - 4:00pm <font size="\&quot;1\&quot;"></font></span> </div></td>
    </tr>
</table>

this is just the body of the page and the same with the next code only the body was copied over


and the code i have for the send email page looks like this

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

the problem i am facing is that i need to set a page which has mysql in it to retrieve images from a database as a newsletter.

i am at the stage where i have all the application set up and it works how it is meant; but it will not load the content of the page into the email which is sent out. the email is just a blank page.

i have used the file get contents function of php and the fopen which both had the same result, the closest i have got to it passing the data on is a couple of semi colons on the page which is the end of the code for the mysql on th original page.

i no there is away of sending the page as an attachment but it needs to have the page set as the email.

i have been working on this now for the last few days and i would really like to no if it is possible to do what i need with the methods i have been using or if i should try a different method

kevin wood 29 Posting Whiz

the solution to the problem that i was facing is as follows:

if you want the links from the buttons to open in the same window then the code to use looks like this:-

on (release){
getURL("../construction/index.htm");
}

the file being linked to is written the same as it would be in html code and to get the link to open in a new window then the code is:-

on (release){
getURL("../construction/index.htm" "blank");
}
peter_budo commented: Thank you for sharing +7
kevin wood 29 Posting Whiz

i have now changed the self part so it is _self and it has made the button stop working. they are not taking you to any page now just staying on the page it was on to start with.

kevin wood 29 Posting Whiz

i have got it to navigate to the new pages from the home page but it keeps opening the new page in a new tab the code i have used looks like this

on (release){
getURL("construction/index.htm", "self");

}

where i have put self should this not open the page in the same window/tab.

if not anyone know what should be put in so it opens in the same window.

kevin wood 29 Posting Whiz

hello,

i have created a flash menu to go on to a website that i am building but i have come to a point were i cannot find the actionscript i ned to get the buttons to go to the pages that i want.

the problem is that i need the buttons to navigate around my site and i have only been able to find the code which will take the user to a new web site. does anyone know what the script is to get the buttons to move around the pages within the site. or can anyone pot a link of a tutorial which will explain how to do this.

my search will go on so if i get the answer i need before anyone posts i will put the address where i found it up here.

kevin wood 29 Posting Whiz

try looking here as well it gives good information on a lot of different php functions this link will take you to what you need.

http://www.tizag.com/phpT/fileread.php

kevin wood 29 Posting Whiz

have you tried the fgets() function. there is a tutorial on how to use this function at

http://php.about.com/od/advancedphp/ss/php_read_file_4.htm

hope this helps

kevin wood 29 Posting Whiz

i have looked at the fopen function over the weekend and i thought that the get file_get_contents function would work better than the fopen.

the code i am using now looks like this $message = file_get_contents ('my website'); but on the email that is sent out it has no content held within it.

do i need to use the fopen, fread, or fwrite functions to get it to display the contents of the page. the page that i am trying to display uses nysql to retrieve images from a database and places them on to the page.

i have a line of code at the bottom which states what should be sent with the message which looks like this mail($contactemail, $subject, $message, $headers); should the variable message be set to the contents of the page and therefore be displayed in the message body.

kevin wood 29 Posting Whiz

this looks like the way forward for now i will research into this over the weekend and see what i can come up with. thanks once again for you help.

kevin wood 29 Posting Whiz

that has done better than the rest. it has tried to send the mail but only the very last line was showing up on the email. none of the images or text has come through with it.

where the php is on the page being sent it has just sent the closing tags and not the actual image that is being recalled from the db on that page.

kevin wood 29 Posting Whiz

it worth giving it a go not much else has seemed to work up to now.

kevin wood 29 Posting Whiz

Why not write a new script ? You can check this example here to send mails with attachments.
http://www.webcheatsheet.com/PHP/send_email_text_html_attachment.php

this would send the newsletter as an attachment would it not?

i would be happy to do it this way but i do not have the final say on how the email will look and the boss wants the email to be the message without attachments.

kevin wood 29 Posting Whiz

i have just been looking more at the example that uses the textarea and to get the body of the message imported into the email it uses this $message = $_REQUEST["body"]; could this line of ode be modified so that instread of the body in the request it would look something like this $message = $_REQUEST["broad_prev.php"]; can the $_request variable be used to recall a page instead of an textarea?

kevin wood 29 Posting Whiz

the $subject variable i used for the message title so this is not going to work either. i ahve just been looking at some code which uses a textarea for the body of the message can this be edited so that the text area contains the preview page.

kevin wood 29 Posting Whiz

on looking into it the a href would probably not work but is it possible to set the subject of the message to be a php page as this way the php will not have to be put into the message body an it should not throw up any errors (if it works).

kevin wood 29 Posting Whiz

the last line of mysql query now looks like this $message.= '<img src="'.$row['broad1'].'"/>'; i think that is how you wanted me to put it. it is now giving me an error when i try to load the page saying unexpected $ at the end of the code but this must have something to do with the $message=. within the html code.

can the mail function only send pure html with no php inside the message body. if that is the case could something like $message=<a href="broad_prev.php"></a> work to get the page to display once the email has been sent.

kevin wood 29 Posting Whiz

I didn't get you.. What I said was,
concat <img src='row1> to $message. So, it will be like,
$message.=$row1;
then again,

$message.=<p>&nbsp;</p></div></th>
        <td width=\"77%\" scope=\"col\"><table width=\"99%\" border=\"0\" cellpadding=\"10\" cellspacing=\"0\">
            <tr> //.... and so on

would this not just send the image as the message and not put any of the text to go with it.

also there will be more than one image to be placed on this page, that is why i was asking if it would be possible to assign the data from the db to their own variables.

the page that will be emailed out will have a title section with an image and some body text and underneath that there will be the same again with different titles images and text.

kevin wood 29 Posting Whiz

instead of putting the code in for the message is there not a way to just recall the page which already has the images inserted into it from the database. the page is created when the user goes to the preview page.

i was trying to work this out using an i frame but when it went to the page where it tells the user the message was sent it was displaying the preview page over the top of that page and the email was blank.

if that could be done it would save duplicating the code to produce the same page twice and if it can be done it would save the hassle of trying to insert images into the code for the message as it clearly does not want mysql code in that section of the code.