Hello All,
Im new to this forum, and i've been coding PHP for a few years now. Anyway, enough of my history, I've recently discovered the GD libraries, and I've got a page where i want to create a grid of dynamically generated thumbnails. Long and short of it is, Its a gallery with the ability to comment, however, when i display the thumbnails, I want the thumbnail image to be dynamically created with a little circle and a number displaying the amount of comments in it. However, when I parse the page, I end up with the last thumbnail and the last number generated for all the thumbnails (if that makes any sense) - it seems that I can only use one session variable for each page.
the code for the thumbnail.php is:
<?php
session_start();
header("Cache-Control: no-store, no-cache, must-revalidate");
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache");
$comments = $_SESSION['howManyComments'];
$tmpImg = $_SESSION['ImgRef'];
$im = @ImageCreateFromPNG($tmpImg);
$circ = @ImageCreateFromPNG("img/circle.png");
$bg = ImageColorAllocateAlpha($im,0,0,0,127);
ImageCopy($im,$circ,68,48,0,0,31,20);
//Three Letters (999)
//ImageString($im,3,77,51,"99",ImageColorAllocate($im,0,165,8));
//Two Letters (99)
//ImageString($im,3,80,51,"9",ImageColorAllocate($im,0,165,8));
//One Letter
ImageString($im,3,73,51,$comments,ImageColorAllocate($im,0,165,8));
imagealphablending($im, false);
imagesavealpha($im, true);
Header ('Content-type: image/png');
imagePNG($im);
ImageDestroy($im);
?>
I could do with either:
1. A better way to pass variables into Thumbnail.php (called by an IMG SRC)
2. an answer.
😛
Any help is greatly appreciated.
~Chud37