function get_albums()
 {
     $url = $this->get_sanitized_username();
     $data = $this->call_fb($url . "/albums?fields=name,from,cover_photo");
     if (is_wp_error($data)) {
         return $data;
     }
     $result = array();
     $no_paging = false;
     while (!$no_paging) {
         foreach ($data['data'] as $album) {
             if (!empty($album['cover_photo'])) {
                 $photo_id = $this->call_fb($album['cover_photo']);
                 if (!is_wp_error($photo_id)) {
                     $photo_id = $photo_id['images'][0]['source'];
                 }
             } else {
                 $photo_id = new WP_Error(0, 'No photo');
             }
             $album_data = array('id' => $album['id'], 'cover' => is_wp_error($photo_id) ? '' : asg_get_image_url($photo_id, array('height' => 180)), 'title' => $album['name']);
             $result[] = $album_data;
         }
         if (isset($data['paging']['cursors']['after'])) {
             $data = $this->call_fb($url . "/albums?after=" . $data['paging']['cursors']['after']);
             if (is_wp_error($data)) {
                 return $data;
             }
         } else {
             $no_paging = true;
         }
     }
     return $result;
 }
 function get_collections()
 {
     $oauth = new ASG_500px_OAuth($this->source['consumer_key'], $this->source['consumer_secret'], $this->source['access_token'], $this->source['access_token_secret']);
     $data = $oauth->get('https://api.500px.com/v1/collections');
     if (!$data) {
         return new WP_Error(1, __('Error fetching collections', 'asg)'));
     }
     foreach ($data->collections as $collection) {
         $first_photo = null;
         if (count($collection->photos)) {
             $first_photo = $collection->photos[0];
         }
         $collections[] = array('id' => $collection->id, 'title' => $collection->title, 'cover' => $first_photo ? asg_get_image_url($first_photo->image_url, array('height' => 180)) : null);
     }
     return $collections;
 }
echo (double) $gallery['overlay']['opacity'] * 100;
?>
);
	}
	<?php 
if ($gallery['overlay']['image']) {
    ?>
		#awesome-gallery-<?php 
    echo $id;
    ?>
 .asg-image-overlay{
			<?php 
    $image = wp_get_attachment_image_src($gallery['overlay']['image'], 'original');
    ?>
			background-image: url('<?php 
    echo asg_get_image_url(preg_replace("%^" . preg_quote(home_url()) . "%", '', $image[0]), array('width' => $image[1] / 2.0, 'height' => $image[2] / 2.0));
    ?>
');
			background-position: center center;
			background-repeat: no-repeat;
		}
		@media only screen and (min--moz-device-pixel-ratio: 2),
			only screen and (-o-min-device-pixel-ratio: 2/1),
			only screen and (-webkit-min-device-pixel-ratio: 2),
			only screen and (min-device-pixel-ratio: 2){
			#awesome-gallery-<?php 
    echo $id;
    ?>
 .asg-image-overlay{
				<?php 
    $image = wp_get_attachment_image_src($gallery['overlay']['image'], 'original');
 function get_image_url($url, $pixel_ratio = 1)
 {
     switch ($this->gallery['layout']['mode']) {
         case 'horizontal-flow':
             $options = array('height' => $this->gallery['layout']['height']);
             break;
         case 'vertical-flow':
             $options = array('width' => $this->gallery['layout']['width']);
             break;
         default:
             $options = array('width' => $this->gallery['layout']['width'] - $this->gallery['border']['width'], 'height' => $this->gallery['layout']['height'] - $this->gallery['border']['width']);
     }
     $options['pixel_ratio'] = $pixel_ratio;
     return asg_get_image_url($url, $options);
 }
 function get_photosets()
 {
     $user_id = $this->find_user_id();
     if (is_wp_error($user_id)) {
         return $user_id;
     }
     $data = $this->flickr_get('flickr.photosets.getList', array('user_id' => $user_id, 'per_page' => 500));
     $result = array();
     foreach ($data['photosets']['photoset'] as $photoset) {
         $result[] = array('id' => $photoset['id'], 'cover' => asg_get_image_url($this->get_photo_url($photoset), array('width' => 240, 'height' => 240)), 'title' => $photoset['title']['_content']);
     }
     return $result;
 }