image links not working

Discussion in 'Web Design, HTML And CSS' started by boygenius, Jul 2, 2008.

  1. boygenius

    boygenius New Member

    Joined:
    Apr 25, 2008
    Messages:
    4
    Likes Received:
    0
    Trophy Points:
    0
    i have created an image gallery using php.
    everything if fine except that the links to the full images are not working.
    www.nitesh.x10hosting.com/gallery.php
    the thumbnails are linked to the full image , however this does not work as expected.
     
  2. shabbir

    shabbir Administrator Staff Member

    Joined:
    Jul 12, 2004
    Messages:
    15,375
    Likes Received:
    388
    Trophy Points:
    83
    Your images are linked to gallery.php?album_name=illusions&max=10 and so they don't show complete images when gallery.php shows with the above parameter
     
  3. boygenius

    boygenius New Member

    Joined:
    Apr 25, 2008
    Messages:
    4
    Likes Received:
    0
    Trophy Points:
    0
    i changed the links of some of the images to absolute ones(see gallery illusion) , but even that did not work.
    the problem seems to be something else as when i put a "image" link on that page to one of the images it worked fine,but the thumbnails do not link.
    one more thing i would like to add is that the links work fine in IE6 and OPERA but not in firefox and safari
     
  4. shabbir

    shabbir Administrator Staff Member

    Joined:
    Jul 12, 2004
    Messages:
    15,375
    Likes Received:
    388
    Trophy Points:
    83
    There is definitely some problem in your code and if you share that we may be able to help
     
  5. boygenius

    boygenius New Member

    Joined:
    Apr 25, 2008
    Messages:
    4
    Likes Received:
    0
    Trophy Points:
    0
    here's the portion of the code(gallery.php) that generates the images and links

    PHP:
    if(!$_GET['album_name'])
    {}
    else
    {
            
    $album_name=$_GET['album_name'];
            
    $max=$_GET['max'];
            if(!isset(
    $_GET['pic_num'])) $_GET['pic_num']=0;
            
    $pic_num=$_GET['pic_num']; 
              
            require(
    'db_login_details.php');
              
            
    $connection=mysql_connect($db_hostname$db_username$db_password);
            if(!
    $connection)
            die(
    "Failed to connect to database".mysql_error());
            
            
    // for previous        
            
    if(!$pic_num)
            
    $previous="#nogo";
            else
            {
    $temp=$pic_num-9;
            
    $previous="gallery.php?album_name=$album_name&pic_num=".$temp."&max=$max;
            }
            
            
    $query="SELECT pic_num,pic_name,pic_thumb,pic_full,pic_size,pic_desc FROM wizkid_mysite.gallery_$album_name where pic_num > '$pic_num'";
    //          echo"\n<br/>pic_num = $pic_num <br/>$query";
             
    $query_result=mysql_query($query);
             echo
    "\n<div class=\"gallery\"><ul>";
             if(!
    $query_result)
             {
             die(
    "<br/>table ".mysql_error());
             }
             
             
    $i=0;
             while((
    $row=mysql_fetch_row(($query_result)))&&($i++<9))
             {
                 echo
    "\n<li>
                    \n 
                    \n<a href=\"
    $row[3]\">
                    \n<img src=\"
    $row[2]\" width=\"100px\" height=\"100px\" alt=\"$row[5]\"/>
                    \n</a>
                    \n</li> "
    ;
                
    $for_next=$row[0];
                
                    
             }
    //         if(!($row=mysql_fetch_row(($query_result)))&&$i++<9)
                
    while(($i)%3!=0)
                {
                 
    $i++;
                 echo
    "\n<li style=\"visibility:hidden;\"><a><img></a></li>";    
                }
             echo
    "\n</ul></div>";
     
    // for  next
    //    echo"<br/>for_next= $for_next max=$max<br/>";
        
    if($for_next<$max)
        
    $next=htmlentities($_SERVER['PHP_SELF'])."?album_name=$album_name&pic_num=$for_next&max=$max";
        else
        
    $next="#nogo";
            echo
    "\n<br/><p class=\"album_nav\">
                 \n<a href=\""
    .$previous."\">previous</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\n<a href=\"".$next."\">next</a>             
                \n<a href=\""
    .htmlentities($_SERVER['PHP_SELF'])."\">Change ALbum</a>
                \n</p>"
    ;
                
    mysql_close($connection);
                 
    }
     
  6. shabbir

    shabbir Administrator Staff Member

    Joined:
    Jul 12, 2004
    Messages:
    15,375
    Likes Received:
    388
    Trophy Points:
    83
    There are lots of error like <a><img></a>

    You should see how to display the image

    Apart from that code you don't have the img tag to display full image
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice