I have a php script which takes in a photo and positions it accordingly in my web page.
I’ve been using it for years now with php 7.4 but when my ISP upgraded php to 8.2, it broke.
The web page that accesses it (simplified) looks like this:
<html>
<head>
<title>PHP Test</title>
<?
require ("photos_placement_simple.inc");
?>
</head>
<body>
<?php
error_reporting(E_ALL);
ini_set('display_errors', TRUE);
ini_set('display_startup_errors', TRUE);
?>
<?php echo '<p>Hello World</p>';
$result1 = getimagesize("../VCSC_articles/images-articles/1957-Airbox-Corvette-970679_a" . "_s.jpg");
echo"$result1 is $result1[1]<br />n";
echo"$result2 is $result1[2]<br />n";
echo"$result3 is $result1[3]<br />n";
?>
<?php
one_photo ('1957-Airbox-Corvette-970679_a', '1957 Airbox Corvette Sold at Mecum Auctions');
?>
</body>
</html>
The php script that is accessed (photos_placement_simple.inc) is (again simplified):
<?php
function one_photo($photo1, $photo1_title) {
// Lets determine the height and width of the graphic
$result1 = getimagesize("../VCSC_articles/images-articles/$photo1" . "_s.jpg");
$left = (390 - ($result1[0] / 2)) + 10;
$height = $result1[1] + 10;
echo "<div style="height:"."$height"."px;">n";
echo "<span style="position:absolute; left:" . $left . "px;">n";
echo "<a href="../../VCSC_articles/images-articles/$photo1.jpg" rel="lytebox" ";
if (isset($photo1_title)){echo "title="$photo1_title">";}
echo "<img src="../../VCSC_articles/images-articles/"."$photo1"."_s.jpg" alt="$photo1_title" width="$result1[0]" height="$result1[1]" border="0"></a>n";
echo "</span>n";
echo "</div>nn";
}
?>
The fatal error occurs at the one_photo (‘1957-Airbox-Corvette-970679_a’, ‘1957 Airbox Corvette Sold at Mecum Auctions’); line. The error is “Uncaught Error: Call to undefined function one_photo()” so I guess my question is: How do I define the one_photo() function?
I have the ability to rollback to php 7.4 via .htaccess so it all works for my users. Still I want to be able to use the latest php version. The site is hardcoded via BBEdit, not WordPress, etc.
Comments, suggestions and solutions are appreciated.
~paul