Same code but some photos won"t show.

Same code but some photos won"t show.

am 27.02.2011 22:03:13 von Bill Mudry

I finally got code going to show off UV fluorescent (wood) photos.
All pages are dynamically formed with PHP and MySQL. Most photos show
but, strangely --- some do not, even though it is the same code that
is forming each page according to what a user picks as the species to view.

In fact, most pages form fine right to the last item at the bottom of the
page ---- but most of the ones that do not form mysteriously hang up
well before the part where the picture should form. For the
fluorescence page for Acacia albida, for instance the output shows no
picture but only:
............................................................ ........................................

Close this Window


Ultraviolet Fluorescence Photo of Acacia albida

(Only 10 to 15% of all wood species fluoresce under UV)

............................................................ ..........................................................

All photos are JPEG,s taken with a digital camera, both those that show ok
and those that refuse to. So far I have only fluorescence photos of woods
starting with alphabetical names starting with A. The default folder where all
the php and html files are is /taxa. The photos (considering there is only
those starting with A) are all stored in /taxa/uv/uva. The path and file names
are stored in (MySQL) table 'uvphotos' in column 'uv_filename.

To arrive at one of these pages, users have to:
- pick a species (under alphaspecies.php) from as much as over
15,000 wood names. It will take a user to a data page on that
chosen species. Just below is three pop-up windows, including
the one for UV photos.
There is a photo icon in the alpha species menu but no icon yet to give an
advance indication of which species have UV photos. I am on the coding
trail to arrange that, hopefully soon. To help illustrate the problem I am
describing, the Acacia aneura UV photo comes up fine, while you can
observe

Acacia acuminata as one that does not show its UV

picture. A shortcut to the alphabetical listings is:
http://www.prowebcanada.com/taxa/alphaspecies.php

Summary:
So ...... some UV photos show while others do not, even though it is the
SAME code forming both. All photos are valid, not corrupted JPEG files.
This is a total mystery to me.

Has anyone else came across such an error or bug? What is causing it
---- and far more ---- how do I rectify this?.

I will include all the code for the whole page but you should find
that the most
relevant code is roughly between lines 120 and 130.

=================== Code follows =========================

[Code}
//////////////////////////////////////////////////////////// ////////////////////////////////////////////
// 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.
// PARAMETERS:
// {$_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
//////////////////////////////////////////////////////////// ////////////////////////////////////////////
session_start();

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

"http://www.w3.org/TR/html4/loose.dtd">


TAXA: Ultraviolet Wood Fluorescence











Close
this Window







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



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

$dbname="taxa";
$db = mysql_select_db($dbname, $connection)
or die("Unable to connect to database");
/*
------------------------------------------------------------ --------------------
HOPEFULLY CONNECTED AT THIS POINT
------------------------------------------------------------ ----------------------

*/

//////////////////////////////////////////////////////////// ///////////////////////////////////////////
//
SECTION TO DISPLAY WOOD SCANS
//////////////////////////////////////////////////////////// /////////////////////////////////////////

Echo "
";

Echo "

Ultraviolet Fluorescence Photo of
{$_SESSION["speciesname"]}

";

Echo "

(Only 10 to 15% of all wood
species fluoresce under UV)

";
//Echo "Line 74
";

$speciesname = $_SESSION["speciesname"]; //Successful
transfer of ssssion parameter to a variable.
//Echo "The species name is - $speciesname
"; //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
";

$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 -
$uvquery
"; //debug statement

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

if(!$uvresult)
die(mysql_error())
;

//ECHO "
\$uv_filename is - $uv_filename
";


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

if(mysql_num_rows($uvresult) >0){
$row = mysql_fetch_array($uvresult);
//ECHO "\$row on line 99 is - $row
";
};

//$row = mysql_fetch_array($uvresult);
//ECHO "\$row on line 104 is - $row
";


EXTRACT($row);
//ECHO "\$row on line 108 is - $row
";
//ECHO "The path and file name, line 120 is
$row('uv_filename')
";

$uv_filename = $row['uv_filename'];

//ECHO "the uv photo name is - $row[0]
";

$uvpath = "./uv/$uv_filename";

ECHO "
";


Echo "
END OF PICTURE AREA

";

//ECHO "
";

Echo "
";



?>










Close
this Window








[/code]



--
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Re: Same code but some photos won"t show.

am 28.02.2011 03:22:36 von Niel Archer

> I finally got code going to show off UV fluorescent (wood) photos.
> All pages are dynamically formed with PHP and MySQL. Most photos show
> but, strangely --- some do not, even though it is the same code that
> is forming each page according to what a user picks as the species to view.



> ............................................................ .......................................
> //////////////////////////////////////////////////////////// ///////////////////////////////////////////
> //
> SECTION TO DISPLAY WOOD SCANS
> //////////////////////////////////////////////////////////// /////////////////////////////////////////
>
> Echo "

";
>
> Echo "

Ultraviolet Fluorescence Photo of
> {$_SESSION["speciesname"]}

";

'center' shouldn't have the single quotes escaped.


>
> $uvquery = "
> SELECT u.uv_filename
> FROM uvphotos u
> JOIN species s
> ON u.species_name=s.species_name
> WHERE u.species_name = '$speciesname'";

You can't split a normal string over multiple lines like this



Fix those and see what happens ;-)

--
Niel Archer



--
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Re: Same code but some photos won"t show.

am 28.02.2011 05:31:25 von Bill Mudry

--=====================_1341196864==.ALT
Content-Type: text/plain; charset="us-ascii"; format=flowed

Thanks for an initial effort. Unfortunately, although I made both changes, it
did not eliminate this strange effect. For example, Acacia acuminata and
Acacia albida do not complete their uv pages while
Acacia
aneura finishes its
page just fine, picture included.

Feel welcome to try out any of these at (shortcut ....):
http://www.prowebcanada.com/taxa/alphaspecies.php

- Pick a species name first and the link will take you to
the data page
for the chosen page. Click on the UV fluorescence button. Some
UV photos show fine but some pages hang and don't even
complete (strange!).

Bill


At 09:22 PM 2/27/2011, you wrote:
> > I finally got code going to show off UV fluorescent (wood) photos.
> > All pages are dynamically formed with PHP and MySQL. Most photos show
> > but, strangely --- some do not, even though it is the same code that
> > is forming each page according to what a user picks as the species to view.
>
>
>
> >
> ............................................................ .......................................
> >
> //////////////////////////////////////////////////////////// ///////////////////////////////////////////
> > //
> > SECTION TO DISPLAY WOOD SCANS
> >
> //////////////////////////////////////////////////////////// /////////////////////////////////////////
> >
> > Echo "

";
> >
> > Echo "

Ultraviolet Fluorescence Photo of
> > {$_SESSION["speciesname"]}

";
>
>'center' shouldn't have the single quotes escaped.
>
>
> >
> > $uvquery = "
> > SELECT u.uv_filename
> > FROM uvphotos u
> > JOIN species s
> > ON u.species_name=s.species_name
> > WHERE u.species_name = '$speciesname'";
>
>You can't split a normal string over multiple lines like this
>
>
>
>Fix those and see what happens ;-)
>
>--
>Niel Archer
>
>
>
>--
>PHP Windows Mailing List (http://www.php.net/)
>To unsubscribe, visit: http://www.php.net/unsub.php

--=====================_1341196864==.ALT--

Re: Same code but some photos won"t show.

am 28.02.2011 09:38:14 von Ferenc Kovacs

--001485f90d9ac7216d049d53993c
Content-Type: text/plain; charset=UTF-8

On Mon, Feb 28, 2011 at 3:22 AM, Niel Archer wrote:

> > I finally got code going to show off UV fluorescent (wood) photos.
> > All pages are dynamically formed with PHP and MySQL. Most photos show
> > but, strangely --- some do not, even though it is the same code that
> > is forming each page according to what a user picks as the species to
> view.
>
>
>
> >
> ............................................................ .......................................
> >
> //////////////////////////////////////////////////////////// ///////////////////////////////////////////
> > //
> > SECTION TO DISPLAY WOOD SCANS
> >
> //////////////////////////////////////////////////////////// /////////////////////////////////////////
> >
> > Echo "

";
> >
> > Echo "

Ultraviolet Fluorescence Photo of
> > {$_SESSION["speciesname"]}

";
>
> 'center' shouldn't have the single quotes escaped.
>
>
> >
> > $uvquery = "
> > SELECT u.uv_filename
> > FROM uvphotos u
> > JOIN species s
> > ON u.species_name=s.species_name
> > WHERE u.species_name = '$speciesname'";
>
> You can't split a normal string over multiple lines like this
>
>
AFAIK, yes you can.

Tyrael

--001485f90d9ac7216d049d53993c--

Re: Same code but some photos won"t show.

am 28.02.2011 11:20:22 von Richard Quadling

On 28 February 2011 02:22, Niel Archer wrote:
>>
>>          $uvquery =3D "
>>          SELECT u.uv_filename
>>          FROM uvphotos u
>>          JOIN species s
>>          ON u.species_name=3Ds.species_name
>>          WHERE u.species_name =3D '$speciesname=
'";
>
> You can't split a normal string over multiple lines like this
>
>
>
> Fix those and see what happens ;-)
>
> --
> Niel Archer

Neil,

$string =3D "This is line 1.
This is line 2.
This is line 3.";
echo $string;
?>

outputs ...

This is line 1.
This is line 2.
This is line 3.

There is no magic here. The string contains newlines and are carried
through to the output as expected.

Richard.

--=20
Richard Quadling
Twitter : EE : Zend
@RQuadling : e-e.com/M_248814.html : bit.ly/9O8vFY

--
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Re: Same code but some photos won"t show.

am 28.02.2011 20:36:59 von Niel Archer

> On 28 February 2011 02:22, Niel Archer wrote:
> >>
> >> =A0 =A0 =A0 =A0 =A0$uvquery =3D "
> >> =A0 =A0 =A0 =A0 =A0SELECT u.uv_filename
> >> =A0 =A0 =A0 =A0 =A0FROM uvphotos u
> >> =A0 =A0 =A0 =A0 =A0JOIN species s
> >> =A0 =A0 =A0 =A0 =A0ON u.species_name=3Ds.species_name
> >> =A0 =A0 =A0 =A0 =A0WHERE u.species_name =3D '$speciesname'";
> >
> > You can't split a normal string over multiple lines like this
> >
> >
> >
> > Fix those and see what happens ;-)
> >
> > --
> > Niel Archer
>=20
> Neil,
>=20
> > $string =3D "This is line 1.
> This is line 2.
> This is line 3.";
> echo $string;
> ?>
>=20
> outputs ...
>=20
> This is line 1.
> This is line 2.
> This is line 3.
>=20
> There is no magic here. The string contains newlines and are carried
> through to the output as expected.
>=20
> Richard.

Sorry my mistake. I was tired and thinking it needed HEREDOC ;-)

> --=20
> Richard Quadling
> Twitter : EE : Zend
> @RQuadling : e-e.com/M_248814.html : bit.ly/9O8vFY
>=20
> --=20
> PHP Windows Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php

--
Niel Archer



--
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Re: Same code but some photos won"t show.

am 28.02.2011 20:55:02 von Tommy Pham

On Sun, Feb 27, 2011 at 1:03 PM, Bill Mudry wrote:
> I finally got code going to show off UV fluorescent (wood) photos. All pa=
ges
> are dynamically formed with PHP and MySQL. Most photos show but, strangel=
y
> ---  some do not, even though it is the same code that is forming ea=
ch page
> according to what a user picks as the species to view.
>
> In fact, most pages form fine right to the last item at the bottom of the
> page ---- but most of the ones that do not form mysteriously hang up
> well before the part where the picture should form. For the
> fluorescence page for Acacia albida, for instance the output shows no
> picture but only:
> ............................................................ .............=
...........................




For the pictures that doesn't show, did you look at the HTML source to
see if the URL of the image is valid, ie. the image actually exists in
the said path & file name? Also, some browsers don't interpret blank
space in the URL well. You'll have urlencode [1] it.

Regards,
Tommy

[1] http://php.net/urlencode

--
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php