PHP Scripts
Create a thumbnail from a larger image and popup the original
This
assumes you have a large image stored at your website, and it is referenced in
a MySQL database.
If you're not using MySQL, simply skip those sections that
retrieve the reference image name.
We
use html, php, and javascript to achieve what we want,
1. A small clickable
image without manually creating a thumb
2. A popup window of the original
large image
The
problem with creating a thumbnail is that it needs image/jpeg as a header (file
type identifier) for the browser.
Unfortunately the header's already been
sent by the web page, and we can't send another. This is the error:
"Warning: Cannot modify header information - headers already sent"
One solution is to paste a thumbnail in a new page, and include the new page in our document.
In the example below we begin with an array, doublecheck we haven't lost any image names, check to see if any array is empty, check to see if in each array we have at least one image, and check that the files exist where they're supposed to be.
The database has been connected to, and we have a query result [page][snip php code] //
access the database in the usual way and query //lets
see if the files physically exist This is tn.php <?php
if (file_exists($im1)) { </DIV></TD><TD WIDTH="33%"><DIV ALIGN="LEFT"> tn1.htm <P><FONT
FACE="Verdana, Arial, Helvetica, sans-serif" SIZE="1"> tn2.htm <P><FONT
FACE="Verdana, Arial, Helvetica, sans-serif" SIZE="1"> tn3.htm <P><FONT
FACE="Verdana, Arial, Helvetica, sans-serif" SIZE="1"> This
is tn11.php, the POPUP <P><FONT
FACE="Verdana, Arial, Helvetica, sans-serif" SIZE="1"> This
is tn22.php, the POPUP <P><FONT
FACE="Verdana, Arial, Helvetica, sans-serif" SIZE="1"> This
is tn33.php, the POPUP <P><FONT
FACE="Verdana, Arial, Helvetica, sans-serif" SIZE="1"> Finally, the thumbnail.php that generates the thumb is in the same directory as these files
|