Hi, I saw the following in the code of a hit counter. <img src="http://domain.com/count.php?id=1&type=2"> I think they are calling a php script in a Image tag. Can that be done? If yes, how will I read the variables "id" and "type"? Then show a picture... It's confusing. Can you please help me here? Thank you jeet
Those are GET variables, so you would access them by $_GET['var_name']. $id = $_GET['id']; $type = $_GET['type']; Making images is pretty simple or pretty challenging depending on what you're doing. Here's a very basic example: <?php //make sure "<?php" is the [B]first line[/B]. Any whitespace or characters before it will break the script header('Content-type: Image/png'); $im = imagecreate('200', '200'); //creates a 200 x 200 image //The first color you define will fill the image. In this case white is fine. Use imagefill() otherwise $white = imagecolorallocate($im, 255, 255, 255); $red = ImageColorAllocate ($im, 192, 0, 0); $blue = imagecolorallocate($im, 0, 0, 255); ImageString($im, 3, 5, 5, 'This is a test!', $red); //prints a string on your image imagepng($im); //This actually outputs your image imagedestroy($im); //Clears memory and the temp file created (I think) ?>//No trailing whitespace or characters Code (markup): For more go to PHP.net http://us2.php.net/manual/en/ref.image.php -the mole
I cannot express how much amazed I am !!! For a moment I think my eyes would have popped out... Thanks so much for introducing me to a whole new set of programming. Thank you Best wishes for you. jeet
You will need to have the GD library installed to use the image functions mentioned above. You can also show an image file with the filesystem functions: <?php header('Content-Type: image/gif'); $open = @fopen('/path/to/image','r'); @fpassthru($open); @fclose($open); ?> PHP:
Cool alternative... So many thanks for your help guys!!! Really I am short of words to thank you all who help me here at DP . Once again, Thank you for the help! Best wishes for you. jeet