Hello everybody, I'm currently attempting to mask the links of my site's images by outputting them through a php script. Information such as name and date is stored in a mysql database and used to obtain the full path to each image. I have 2 main files. The files (view.php & thumb.php) are pretty much the same, except that one gets the link for the full-sized image and the other gets the link for the thumb. When accessing either view.php or thumb.php for an individual image, everything works fine. So far, so good. But I want to include a number of thumbs with links to the full-sized versions in my blog. So i created a function for my active template which allows me to post as many images as i want in a post just by searching for 'post_id' in my database (instead of manually typing multiple a href's and img src's ) Now for the problem: At first, everything looked alright, but after browsing through a couple more pages, i noticed that the thumbs started to disappear, first randomly and then complete. If i wait a couple of minutes, everything starts working again, but not for long. What could be the source of this apparent random issue? How can I solve this? Any answers would be very appreciated. Regards, krimson Here is the code: Table's structure: #id, name, year, month, day, post_id, rel Code (markup): thumb.php (it's virtually identical with view.php, except for the ".thumb.jpg" part) <?php include 'db.inc'; $id = clean($_GET['id'], 4); if (empty($id)) exit; if (empty($type)) $type="med"; if (!($connection = @ mysql_pconnect($hostName, $username, $password))) showerror(); if (!mysql_select_db($datab, $connection)) showerror(); $query = "SELECT year, month, day, name FROM xt_images WHERE id=$id"; if (!($result = @mysql_query($query,$connection))) showerror(); $data = @mysql_fetch_array($result); $imagedir = "/home/andrei/public_html/upload/"; $imagepath = $imagedir . $data["year"] . "/" . $data["month"] . "/" . $data["day"] . "/" . $data["name"] . ".thumb.jpg"; // { // Output the MIME header header("Content-Type: image/jpeg"); // Output the image readfile($imagepath); exit(0); // } ?> PHP: Post function: function post_thumbs($post_id, $rel) { if (!($connection = mysql_connect($hostName, $username, $password))) showerror(); if (!mysql_select_db($datab, $connection)) showerror(); $query = 'SELECT id, rel FROM xt_images WHERE post_id='. $post_id .' AND rel="'. $rel .'"'; if (!($result = mysql_query($query,$connection))) showerror(); print('<center>'); while ($line = mysql_fetch_array($result, MYSQL_ASSOC)) { print('<a href="http://img.andreiionita.com/view.php?id='. $line['id'] . '" rel="lightbox['. $rel .']">'); print('<img src="http://img.andreiionita.com/thumb.php?id='. $line['id'] .'" />'); print('</a> '); } print('</center>'); } PHP: