Help - Search - Members - Calendar
Full Version: I am trying to edit my first PHP.
Weborum Webmaster Forum > Web Page Design > PHP
BudmannG
I am working on a random gallery image block. I am running a portal system on my website and trying to put it in it. I have most of the code right now. I am not the author of the code, just trying to get it to work with my board.
Right now it will show the name of the random pic in the title like it is supposed to. I am having problems getting the picture to show in the block. I have tried to get it to show many times and different ways. I am really new at this stuff and don't understand any of this at all. So I am reaching out to you guys here.
How do I get the picture to show also? I will post the code here.

CODE
<?

$content = "";


       $query = $DB->query("SELECT id  FROM ibf_gallery_images");
       $count = $DB->get_num_rows ($query);
       $start  =       rand(0, ($count -1));
       $query = $DB->query("SELECT id, caption as titolo, masked_file_name as file FROM ibf_gallery_images LIMIT $start, 1");
       $foto = $DB->fetch_row($query);
       $id = $foto['id'];
       $titolo = $foto['titolo'];
       $file = $foto['file'];
       $thumb = "tn_$file";


       if (!file_exists("$this->sitepath/forum/gallery/$thumb")) {
               $thumb_mes = $this->ResizeImage(120,"$this->sitepath/mkportal/modules/gallery/album/$file");
               $content = "<td align=\"center\"><a href=\"$mkportals->forum_url/forums/index.php?automodule=gallery&req=si&img=$id\"><img src=\"$mkportals->forum_url/forums/gallery/$file\" border=\"0\"  width='$thumb_mes[0]' height='$thumb_mes[1]'  alt=\"{$this->lang['gallery_zoom']}\"></a></td></tr>
               <tr><td id=\"tdblock\" align=\"center\">$titolo<br></td></tr>";
       } else {
               $content = "<td align=\"center\"><a href=\"$mkportals->forum_url/forums/index.php?automodule=gallery&req=si&img=$id\"><img src=\"$mkportals->forum_url/forums/gallery/$thumb\" border=\"0\" alt=\"{$this->lang['gallery_zoom']}\"></a></td></tr>
               <tr><td id=\"tdblock\" align=\"center\">$titolo<br></td></tr>";
       }

       if(!$id) {
                       $content = "<tr>
                       <td id=\"tdblock\" align=\"center\">
                       {$this->lang['no_galleryim']}
                       </td>
                       </tr>
                       ";
       }

       if(!$mkportals->member['g_access_cp'] && !$this->member['g_access_gallery']) {
                       $content = "<tr>
                       <td id=\"tdblock\" align=\"center\">
                       {$this->lang['gallery_noallow']}
                       </td>
                       </tr>
                       ";
       }

       unset($query);
       unset($count);
       unset($start);
       unset($foto);
       unset($id);
       unset($titolo);
       unset($file);
       unset($thumb);

?>


BudmannG
nm, I got it to work with the help of the author.
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2008 Invision Power Services, Inc.