Example #1
0
 /**
  * get the thumbnail url to the image
  */
 function get_thumbnail_url($imageID, $picturepath = '', $fileName = '')
 {
     /** @var $wpdb wpdb */
     global $wpdb;
     // safety first
     $imageID = (int) $imageID;
     // get gallery values
     if (empty($fileName)) {
         list($fileName, $picturepath) = $wpdb->get_row("SELECT p.filename, g.path FROM {$wpdb->flagpictures} AS p INNER JOIN {$wpdb->flaggallery} AS g ON (p.galleryid = g.gid) WHERE p.pid = '{$imageID}' ", ARRAY_N);
     }
     if (empty($picturepath)) {
         $picturepath = $wpdb->get_var("SELECT g.path FROM {$wpdb->flagpictures} AS p INNER JOIN {$wpdb->flaggallery} AS g ON (p.galleryid = g.gid) WHERE p.pid = '{$imageID}' ");
     }
     // set gallery url
     $folder_url = get_option('siteurl') . '/' . $picturepath . flagGallery::get_thumbnail_folder($picturepath, FALSE);
     $thumbnailURL = $folder_url . 'thumbs_' . $fileName;
     return $thumbnailURL;
 }