I found out some years ago that some woods will actually fluoresce under UV light and that I can photograph that glow. In fact, I estimate over 10$ of the 3,000+ actual wood species samples I have glow under black light.

I have worked on for some time the TAXA Wood Knowledge Base (www.prowebcanada.com/taxa) that reports the existence and information on over 15,000 different wood species. When you pick a certain wood, you are taken to the data page for that wood. On that page (amongst other things) are three pop-up windows. One of them is to display any UV photos I have so far of woods that do glow.

The odd thing about how it is working is that some photos (all JPEG's) show but some do not and I don't know why. All pages with data are dynamically run with PHP and stored in MySQL tables. As a check against corrupt photo files, I have run the ones that do not show in phpAdmin under 'Execute'---- and they showed up fine. If they all didn't show, of course, it would be easy to see that there was a code problem but via the same code, over 2/3 show. Oddly, some critical error is not happening since with the photos that do not show, the page even seems to crash after the first words echos from code.

I will include the full page code. All photos for now are stored under ./uv/uva.
File names and paths are kept in the Taxa database, 'uvphotos' table, 'uvfilename' column.

This one has me stumped. I hope someone has some idea what is causing this.

Bill Mudry
Mississauga,Ontario (near Toronto)


//  Program: show_uv_photos.php
//  Description: This program displays Uv fluorescence photos of wood found to glow under an ultraviolet
//  light. This is around 10% - 15% of all wood species. 
//  It runs as a pop-up window and is activated by a button titled "U.V. Fluorescence" generated by 
//  displayspecies.php. Future code may be added later to display the buttons only if the program can
//  detect UV photos stored for each species.
//      {$_SESSION["speciesname"]} - Looks back to find what the current species picked is.
//		speciesname - The session variable name for the current species.
//		$speciesname - The standard variable name taken from the session variable.	
//		species_name - the name of the column that stores up to over 15,000 different botanical names of wood.
//		uvphotos - the name of the table in the TAXA database that holds the partial path and photo file
//			name

//ECHO "Session variable for species name is - {$_SESSION['species_name']}";  //Debug statement

error_reporting(-1); // Report every single error going.
ini_set('display_errors', 1); // Show them in-line.
set_time_limit(0); // No time limit.
// The rest of your code is on the next line and onwards.


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<title>TAXA: Ultraviolet Wood Fluorescence</title>


<body bgcolor='ivory'>

<table align='center' cellpadding='5', Cellspacing='0' border =0>
	<td valign='top'>
		<form name='NewWin'>
			<p><A href="javascript: self.close ()">Close this Window</A></p>


# ////////////////////////////////////////////////////////////////////////////////////
#				            CONNECT TO DATABASE
# ////////////////////////////////////////////////////////////////////////////////////

include ("connecttotaxa.php");
$connection = mysql_connect($hostname, $username, $password) 
	or die("Unable to connect to database server");

$db = mysql_select_db($dbname, $connection)
	or die("Unable to connect to database");


	Echo "<div align = 'center'>";

	Echo "<H2 align=\'center\'>Ultraviolet Fluorescence Photo of 
	Echo "<p align='center'><I>(Only 10 to 15% of all wood species fluoresce under UV)</I></p>";
	//Echo "Line 74<br />";
	$speciesname = $_SESSION["speciesname"]; //Successful transfer of ssssion parameter to a variable.
	//Echo "The species name is - $speciesname<br />"; //Proof that it transferred properly

	//$uvquery = "SELECT * FROM uvphotos WHERE 'species_name' = $speciesname";
	$speciesname = mysql_real_escape_string($speciesname);
	//ECHO "\$speciesname, line 73 is - $speciesname<br />";
	$uvquery = "
	SELECT u.uv_filename FROM uvphotos u JOIN species s ON u.species_name=s.species_name WHERE u.species_name = '$speciesname'";
	//WHERE u.species_name = 'Acacia aneura'";

	//ECHO "Line 85 -<br /> $uvquery<br />"; //debug statement

	$uvresult = mysql_query($uvquery) or die(mysql_error());

	//ECHO "<br />\$uv_filename is - $uv_filename<br />";

	$numrows = mysql_num_rows($uvresult) or die (mysql_error());
	//ECHO "Number of rows is - $numrows<br />";

	if(mysql_num_rows($uvresult) >0){
		$row = mysql_fetch_array($uvresult);
		//ECHO "\$row on line 99 is - $row<BR />";
	//$row = mysql_fetch_array($uvresult);
	//ECHO "\$row on line 104 is - $row<BR />";
	//ECHO "\$row on line 108 is - $row<BR />";
	//ECHO "The path and file name, line 120 is $row('uv_filename')<BR />";
	$uv_filename = $row['uv_filename'];

	//ECHO "the uv photo name is - $row[0]<br />";
	$uvpath = "./uv/$uv_filename";

	ECHO "<img src='$uvpath'><br />";

  Echo "<br />END OF PICTURE AREA<br /><br />";

	//ECHO "<HR>";

Echo "</div>";


<!-- <h4 align="center">Webmaster: This function is still Under Construction</h4> -->

<table align='center' cellpadding='5', Cellspacing='5' border =1>
	<td valign='top'>
		<form name='NewWin'>
			<p><A href="javascript: self.close ()">Close this Window</A></p>


Edited by Ezzaral: Snipped email. Please keep it on site.

6 Years
Discussion Span
Last Post by gunnarflax

I can't say I found a solution to your problem but I went through your code and saw some things you could try changing.

First: only write echo statements in lower case, now you write it "Echo" and "ECHO".

Secondly: There are some standards you've missed which I've tried to address here:

$uvresult = mysql_query($uvquery) or die(mysql_error());
        //Here you've already checked if the query failed or not so I believe this is  
        //unnecessary, correct me if I'm wrong.
        // Not needed, you check the number of rows in the following if-statement
	//$numrows = mysql_num_rows($uvresult) or die (mysql_error());
        //I Guess what you want is a single row returned, right?
	if(mysql_num_rows($uvresult) == 1){
		$row = mysql_fetch_assoc($uvresult);
        //I believe that to go to the previous directory you need two ".."
	$uvpath = "../uv/".$row['uv_filename'];

        //And if it still doesn't work, try using an absolute path

        // "alt" is a required attribute and without "width" and "height" some legacy 
        //browsers are having trouble displaying the image correctly
	echo "<img src='$uvpath' width='' height='' alt=''>";
  // Use <p> when you can instead of breaks since otherwise it's considered bad html :/
  echo "<p>END OF PICTURE AREA<p>";

echo "</div>";

Also try to write all HTML-tags in lowercase, e.g. "<h2>" and the "align" attribute on <div> is deprecated and css-rules should be used instead, e.g. style="width: 720px; margin: 0 auto;"

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.