Results 1 to 2 of 2

Thread: PHP & Image Power Zoomer

  1. #1
    Join Date
    Nov 2010
    Posts
    5
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default 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

  2. #2
    Join Date
    Sep 2008
    Location
    Bristol - UK
    Posts
    842
    Thanks
    32
    Thanked 132 Times in 131 Posts

    Default

    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.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •