public function show($attributes) { extract(shortcode_atts(array("folder" => "/", "bar" => "the default bar value"), $attributes)); $this->bucket = "vredenburchvriendenteam-nl"; $this->base_folder = $folder; $this->query_folder = self::discover_folder(); $gallery = new Gallery_Display($this->base_folder, $this->query_folder); $iterator = $this->s3_client->getIterator('ListObjects', array('Bucket' => $this->bucket, 'Prefix' => $this->base_folder . $this->query_folder, 'Delimiter' => '/'), array('return_prefixes' => true, 'sort_results' => true)); foreach ($iterator as $object) { if (isset($object['Prefix'])) { $gallery->add_folder($object['Prefix']); } if (isset($object['Key'])) { if ($object['Size'] > 0) { if ($object['Key'] == $this->base_folder . $this->query_folder) { $gallery->add_picture($this->s3_client->getObjectUrl($this->bucket, $object['Key'])); } else { if ($this->total_converted_size < self::MAX_CONVERT_LIMIT) { $thumbnail = $this->create_thumb($object['Key'], $object['Size']); $gallery->add_thumbnail($object['Key'], $this->s3_client->getObjectUrl($this->bucket, $thumbnail)); } } } } } $html = $gallery->show(); if ($this->total_converted_size > self::MAX_CONVERT_LIMIT) { $html .= "<em>Not all thumbnails created yet. Processing max. " . round(self::MAX_CONVERT_LIMIT / 1000000) . " MB at a time.</em><br/><br/>"; } // $bucketlist = "<br><br>"; // $this->buckets = $this->s3_client->listBuckets(); // foreach ( $this->buckets['Buckets'] as $bucket ) { // $bucketlist .= $bucket['Name'] . "<br/>"; // } // $bucketlist .= "<br>"; // $bucketname = print_r( $this->get_setting("bucket"), true ); //$html .= "Showing the element " . $this->query_folder . "<br/><br/>"; // $html .= "folder = {$folder} and {$bar} and "; // $html .= $bucketlist; // $html .= $bucketname; return $html; }
function _HTML_thumbnail(&$image) { if (!($result = parent::_HTML_thumbnail($image))) { return false; } return $this->_HTML_inDiv($result, array('class' => 'gallerycon')); }