require_once "../vendor/autoload.php"; } $ss = new MySqlSlideshow($Host, $User, $Password, $Database); //******************** // This is an Ajax call. // Get the image given an id. // The arguments are: // image=id // type=raw optional argument, if pressent then the raw image data is returned with the proper mime type header. If not present // then returns an echoed data package that can be the argument to "<img src=" tag. // addinfo=1 optional argument, if present and if not specified as raw then the "<::subject::>text<::description::>text" is // appended onto the base64 image packet. If type=raw then addinfo is ignored! if ($_GET['image']) { extract($_GET); if ($type == 'raw') { $ar = $ss->getImage($image, ""); // the second arg defaults to base64 so here we want to unset it. Header("Content-type: {$mime}"); $data = $ar['data']; echo $data; } else { $ar = $ss->getImage($image); // default is base64 Header("Content-type: text/plain"); $data = $ar['data']; $data = "{$data}"; if ($addinfo) { $data .= "<::subject::>{$ar[subject]}<::description::>{$ar['desc']}"; } echo "{$data}"; }
// Get a list of id's. // This function takes one optional arguments: // $where: defaults to "", the where conditions of the query. // You can add where conditions like this for example: "type = 'link' && data like('%bill%.jpg')" then you // would only get link type rather than data type entries and only links with the name bill and jpegs. $ids = $ss->getImageIds(); // Set the session up. $_SESSION['ids'] = $ids; $_SESSION['index'] = 0; // Start at the beginning // Get all the images // For NON IE browsers we can cache the images. if (!$isIe) { $images = array(); for ($i = 0; $i < count($ids); ++$i) { $images[$i] = $ss->getImage($ids[$i]); } $_SESSION['images'] = $images; } // Here is the example of a slide show. // We have two buttons "Start" and "Stop" // and the table with the slideshow mysqlslideshow table displayed (not everything just some). // // The style is to add borders and padding to the table. // $display = $ss->displayAllImageInfo(); echo <<<EOF <html> <head> <style type="text/css"> #displayAllImageInfo * {