-
PHP & Image Power Zoomer
Hi,
I have just viewed the Image Power Zoomer and love what it does, however the instructions say that you have to define a unique image name to apply it to. I am new to PHP and have been making an image uploader that places a link to the image in my database. Is it possible to modify the following code, or that of the Image Zoomer to work with images loaded in this way?
PHP Code:
<?php
require('includes/dbinfo.php');
mysql_connect($host, $username, $password) or die(mysql_error()) ;
mysql_select_db($db_name) or die(mysql_error()) ;
$data = mysql_query("SELECT * FROM image_bank") or die(mysql_error());
?>
<?php
while($info = mysql_fetch_array( $data )) {
Echo "<img src=http:images_new/".$info['photo'] .">; }
?>
Any help greatly appreciated :-)
FF
-
Don't know exactly what you mean, but here's what I think you want:
PHP Code:
<?php
require('includes/dbinfo.php');
mysql_connect($host, $username, $password) or die(mysql_error()) ;
mysql_select_db($db_name) or die(mysql_error()) ;
$data = mysql_query("SELECT * FROM image_bank") or die(mysql_error());
// Start the counter off at 1 (the first image)
$counter = 1;
while($info = mysql_fetch_array( $data )) {
echo "<img src=\"images_new/".$info['photo'] ."\" id=\"image_" . $counter . "\"/>";
// Increment the counter on each loop, for each new image
$counter++;
}
?>
This will output the images, with unique ids like so:
image_1
image_2
etc...
Let me know if you have any issues with this.