Example #1
0
 public function load($url, $parameters = null)
 {
     $regexMatches = $parameters["regex_matches"];
     $itemId = $regexMatches[1];
     // bam
     $info = explode('/map/', $itemId);
     $originalUrl = 'http://api.tiles.mapbox.com/v2/' . $info[0] . '.' . $info[1] . '.json';
     // read feed into SimpleXML object
     $entry = json_decode(file_get_contents($originalUrl));
     $item = new Item();
     $item->setUri((string) $entry->id);
     $item->setTitle((string) $entry->name);
     $item->setAttributionUri((string) $entry->webpage);
     $item->setDateCreated(new \DateTime("now"));
     $item->setMediaType('Map');
     $item->setLayerType('Mapbox');
     $item->setChildItemsCount(0);
     $center = (array) $entry->center;
     $item->setMediaGeoLatitude((string) $center[1]);
     $item->setMediaGeoLongitude((string) $center[0]);
     $item->setAttributes(array('zoom' => (string) $center[2], 'maxzoom' => (string) $entry->maxzoom, 'minzoom' => (string) $entry->minzoom));
     $item->setMediaCreatorUsername((string) $info[0]);
     $item->setMediaCreatorRealname('Unknown');
     $thumbnailUrl = (string) 'http://api.tiles.mapbox.com/v2/' . $info[0] . '.' . $info[1] . '/thumb.png';
     // write metadata
     $item->setArchive('Mapbox');
     $item->setLicense('Unknown');
     $item->setThumbnailUrl($thumbnailUrl);
     $item->setThumbnailUrl($thumbnailUrl);
     return $this->returnResponse($item, true, false);
 }
 public function load($url, $parameters = null)
 {
     // to get the photo id we first need to use the embed API
     $embedApiUrl = "https://api.instagram.com/oembed?url={$url}";
     $embedInfo = file_get_contents($embedApiUrl, 0, null, null);
     $embedInfo = json_decode($embedInfo, true);
     if (null != $embedInfo && isset($embedInfo["media_id"])) {
         $mediaId = $embedInfo["media_id"];
         $mediaApiUrl = "https://api.instagram.com/v1/media/{$mediaId}?access_token=1907240.f59def8.6a53e4264d87413a8e8cd431430b6e94";
         $mediaDetails = file_get_contents($mediaApiUrl, 0, null, null);
         $mediaDetails = json_decode($mediaDetails, true);
         if (null !== $mediaDetails && is_array($mediaDetails) && array_key_exists("data", $mediaDetails)) {
             $mediaDetails = $mediaDetails["data"];
             $item = new Item();
             $item->setTitle($mediaDetails["caption"]["text"]);
             $item->setMediaCreatorUsername($mediaDetails['user']['username']);
             $item->setMediaCreatorRealname($mediaDetails['user']['full_name']);
             $item->setMediaType('Image');
             $item->setLayerType('Image');
             $item->setArchive('Instagram');
             $item->setUri($mediaDetails['images']['standard_resolution']['url']);
             $item->setAttributionUri($mediaDetails['link']);
             $item->setMediaDateCreated(DateTime::createFromFormat('U', $mediaDetails['created_time']));
             $item->setThumbnailUrl($mediaDetails['images']['thumbnail']['url']);
             $tags = $mediaDetails["tags"];
             if (isset($tags)) {
                 $item->setTags($tags);
             }
             $location = $mediaDetails["location"];
             if (null !== $location && is_array($location)) {
                 if (array_key_exists("latitude", $location) && array_key_exists("longitude", $location)) {
                     $item->setMediaGeoLatitude($mediaDetails['location']['latitude']);
                     $item->setMediaGeoLongitude($mediaDetails['location']['longitude']);
                 }
                 if (array_key_exists("name", $location)) {
                     $item->setLocation($mediaDetails['location']['name']);
                 }
             }
             return $this->returnResponse(array($item), true, false);
         }
     }
     return $this->returnResponse(array(), false, true);
 }
Example #3
0
 public function load($url, $parameters = null)
 {
     require_once __DIR__ . '/../../../../../vendor/phpflickr/lib/Phpflickr/Phpflickr.php';
     $flickrAuthenticationKey = $parameters["authentication_key"];
     $loadCollectionItems = $parameters["load_child_items"];
     $checkForDuplicates = (bool) $parameters["check_for_duplicates"];
     $tags = $parameters["tags"];
     $user = $parameters["user"];
     $originalItems = null;
     $searchParameters = array("tags" => $tags, "tag_mode" => "any", "extras" => "path_alias, description, license, date_upload, date_taken, owner_name, geo, tags, url_t, url_s, url_q, url_m, url_n, url_z, url_c, url_l, url_o", "page" => 1, "per_page" => 500);
     if (FALSE !== $checkForDuplicates) {
         $em = $parameters["entityManager"];
         $originalItems = $em->getRepository('ZeegaDataBundle:Item')->findUriByUserArchive($user->getId(), "Flickr");
         if (isset($originalItems)) {
             $checkForDuplicates = TRUE;
         } else {
             $checkForDuplicates = FALSE;
         }
     } else {
         $checkForDuplicates = FALSE;
     }
     $f = new \Phpflickr_Phpflickr("97ac5e379fbf4df38a357f9c0943e140");
     $currentPage = 1;
     $items = array();
     while (1) {
         $searchParameters["page"] = $currentPage;
         $searchResults = $f->photos_search($searchParameters);
         $photos = $searchResults['photo'];
         $pages = $searchResults['pages'];
         foreach ($photos as $photo) {
             $item = new Item();
             $tags = array();
             if (isset($photo['tags'])) {
                 $item->setTags(explode(" ", $photo['tags']));
             }
             if (isset($photo['datetaken'])) {
                 $item->setMediaDateCreated(new DateTime($photo['datetaken']));
             }
             if (isset($photo['ownername'])) {
                 $item->setMediaCreatorUsername($photo['ownername']);
             }
             if (isset($photo['latitude'])) {
                 $item->setMediaGeoLatitude($photo['latitude']);
             }
             if (isset($photo['longitude'])) {
                 $item->setMediaGeoLongitude($photo['longitude']);
             }
             if (isset($photo['license'])) {
                 $item->setLicense(self::$license[$photo['license']]);
             } else {
                 $item->setLicense('All Rights Reserved');
             }
             if (isset($photo["url_l"])) {
                 $item->setUri($photo['url_l']);
             } else {
                 if (isset($photo["url_o"])) {
                     $item->setUri($photo['url_o']);
                 } else {
                     if (isset($photo["url_m"])) {
                         $item->setUri($photo['url_m']);
                     } else {
                         $item->setUri($photo['url_s']);
                     }
                 }
             }
             if (isset($photo["description"])) {
                 $item->setDescription($photo['description']);
             }
             $item->setTitle($photo['title']);
             $item->setAttributionUri("http://www.flickr.com/photos/" . $photo["owner"] . "/" . $photo["id"]);
             $item->setArchive('Flickr');
             $item->setMediaType('Image');
             $item->setLayerType('Image');
             $item->setChildItemsCount(0);
             if (TRUE === $checkForDuplicates) {
                 if (FALSE === array_key_exists($item->getUri(), $originalItems)) {
                     array_push($items, $item);
                 }
             } else {
                 array_push($items, $item);
             }
             if (true !== $loadCollectionItems) {
                 return parent::returnResponse($items, true, true);
             }
         }
         if ($currentPage++ > $pages || $currentPage > 10) {
             break;
         }
     }
     return parent::returnResponse($items, true, true);
 }
Example #4
0
 public function load($url, $parameters = null)
 {
     $loadCollectionItems = $parameters["load_child_items"];
     $checkForDuplicates = (bool) $parameters["check_for_duplicates"];
     $tags = $parameters["tags"];
     $user = $parameters["user"];
     $originalItems = null;
     $items = array();
     $apiUrl = "https://api.instagram.com/v1/tags/{$tags}/media/recent?access_token=1907240.f59def8.6a53e4264d87413a8e8cd431430b6e94";
     $itemsJson = file_get_contents($apiUrl, 0, null, null);
     if (FALSE !== $checkForDuplicates) {
         // temp check for duplicates [with duplicated code]. transition to max_id / min_id later.
         $em = $parameters["entityManager"];
         $originalItems = $em->getRepository('ZeegaDataBundle:Item')->findUriByUserArchive($user->getId(), "Instagram");
         if (isset($originalItems)) {
             $checkForDuplicates = TRUE;
         } else {
             $checkForDuplicates = FALSE;
         }
     } else {
         $checkForDuplicates = FALSE;
     }
     if (null !== $itemsJson) {
         $apiItems = json_decode($itemsJson, true);
         if (null !== $apiItems && is_array($apiItems) && array_key_exists("data", $apiItems)) {
             foreach ($apiItems["data"] as $apiItem) {
                 if (TRUE === $checkForDuplicates) {
                     if (TRUE === array_key_exists($apiItem['images']['standard_resolution']['url'], $originalItems)) {
                         continue;
                     }
                 }
                 $item = new Item();
                 $item->setTitle($apiItem["caption"]["text"]);
                 $item->setMediaCreatorUsername($apiItem['user']['username']);
                 $item->setMediaCreatorRealname($apiItem['user']['full_name']);
                 $item->setMediaType('Image');
                 $item->setLayerType('Image');
                 $item->setArchive('Instagram');
                 $item->setUri($apiItem['images']['standard_resolution']['url']);
                 $item->setAttributionUri($apiItem['link']);
                 $item->setMediaDateCreated(DateTime::createFromFormat('U', $apiItem['created_time']));
                 $item->setThumbnailUrl($apiItem['images']['thumbnail']['url']);
                 $tags = $apiItem["tags"];
                 if (isset($tags)) {
                     $item->setTags($tags);
                 }
                 $location = $apiItem["location"];
                 if (null !== $location && is_array($location)) {
                     if (array_key_exists("latitude", $location) && array_key_exists("longitude", $location)) {
                         $item->setMediaGeoLatitude($apiItem['location']['latitude']);
                         $item->setMediaGeoLongitude($apiItem['location']['longitude']);
                     }
                     if (array_key_exists("name", $location)) {
                         $item->setLocation($apiItem['location']['name']);
                     }
                 }
                 array_push($items, $item);
             }
         }
     }
     return $this->returnResponse($items, true, true);
 }
 public function load($url, $parameters = null)
 {
     require_once '../vendor/facebook/facebook.php';
     $facebook = new \Facebook(array('appId' => '459848834048078', 'secret' => 'f5b344b91bff03ace4df454e35fca4e4'));
     $user = $facebook->getUser();
     if (!$user) {
         $item = new Item();
         $item->setArchive('Facebook');
         $item->setChildItemsCount(-1);
         return $this->returnResponse($item, true, false, "You do not appear to be signed into Facebook.");
     }
     $fbid = $parameters["regex_matches"][1];
     $photoData = $facebook->api($fbid, "GET", array('metadata' => 'true', 'format' => 'json'));
     // check if response is false
     if ($photoData == false) {
         return $this->returnResponse(null, false, false, "You do not have Facebook Permissions to add this media.  The owner of the image can resolve this by changing the image's privacy settings.");
     }
     // check for FB error message
     if (array_key_exists("error", $photoData)) {
         return $this->returnResponse(null, false, false, "Facebook responded with this error message: " . $photoData['error']['message']);
     }
     // do FB permissions matter for static image URLs?
     // if so, we'll need to http get the image and verify the HTTP response
     $item = new Item();
     $tags = array();
     $item->setArchive('Facebook');
     $item->setMediaType('Image');
     $item->setLayerType('Image');
     $item->setChildItemsCount(0);
     $item->setLicense('All Rights Reserved');
     // todo: what are the proper permissions here?
     if (array_key_exists("name", $photoData)) {
         $item->setTitle($photoData["name"]);
     }
     if (array_key_exists("from", $photoData)) {
         if (array_key_exists("name", $photoData["from"])) {
             $item->setMediaCreatorRealname($photoData["from"]["name"]);
             $item->setMediaCreatorUsername($photoData["from"]["name"]);
         }
     }
     if (array_key_exists("source", $photoData)) {
         $item->setUri($photoData["source"]);
     }
     if (array_key_exists("picture", $photoData)) {
         $item->setThumbnailUrl($photoData["picture"]);
     }
     if (array_key_exists("link", $photoData)) {
         $item->setAttributionUri($url);
     }
     if (array_key_exists("from", $photoData)) {
         $item->setMediaCreatorUsername($photoData["from"]["name"]);
     }
     if (array_key_exists("created_time", $photoData)) {
         $item->setMediaDateCreated(new DateTime($photoData['created_time']));
     }
     if (array_key_exists("place", $photoData)) {
         $item->setMediaGeoLatitude($photoData['place']['location']['latitude']);
         $item->setMediaGeoLongitude($photoData['place']['location']['longitude']);
     }
     // tags might exist
     if (array_key_exists("tags", $photoData)) {
         $tags = array();
         foreach ($photoData['tags']['data'] as $fb_tag) {
             array_push($tags, $fb_tag['name']);
         }
         $item->setTags($tags);
     }
     return $this->returnResponse($item, true, false);
 }
Example #6
0
 public function load($url, $parameters = null)
 {
     require_once __DIR__ . '/../../../../../vendor/phpflickr/lib/Phpflickr/Phpflickr.php';
     if (isset($parameters["photo_id"])) {
         $itemId = $parameters["photo_id"];
     } else {
         $regexMatches = $parameters["regex_matches"];
         $itemId = $regexMatches[1];
         // bam
     }
     $f = new \Phpflickr_Phpflickr('97ac5e379fbf4df38a357f9c0943e140');
     $info = $f->photos_getInfo($itemId);
     $size = $f->photos_getSizes($itemId);
     if (is_array($info) && is_array($size)) {
         $item = new Item();
         $tags = array();
         $item->setAttributionUri($info['urls']['url'][0]['_content']);
         if ($info['tags']) {
             $tags = array();
             foreach ($info['tags']['tag'] as $t) {
                 array_push($tags, $t["raw"]);
             }
             $item->setTags($tags);
         }
         foreach ($size as $s) {
             $sizes[$s['label']] = array('width' => $s['width'], 'height' => $s['height'], 'source' => $s['source']);
         }
         //return $sizes;
         $attr = array('farm' => $info['farm'], 'server' => $info['server'], 'id' => $info['id'], 'secret' => $info['secret']);
         if (isset($sizes['Original'])) {
             $attr['originalsecret'] = $info['originalsecret'];
         }
         if (isset($sizes['Large'])) {
             $itemSize = 'Large';
         } elseif (isset($sizes['Original'])) {
             $itemSize = 'Original';
         } elseif (isset($sizes['Medium 800'])) {
             $itemSize = 'Medium 800';
         } elseif (isset($sizes['Medium 640'])) {
             $itemSize = 'Medium 640';
         } elseif (isset($sizes['Medium'])) {
             $itemSize = 'Medium';
         } elseif (isset($sizes['Small 320'])) {
             $itemSize = 'Small 320';
         } else {
             $itemSize = 'Small';
         }
         if (isset($sizes['Medium'])) {
             $thumbSize = 'Medium';
         } elseif (isset($sizes['Small 320'])) {
             $thumbSize = 'Small 320';
         } else {
             $thumbSize = 'Small';
         }
         $item->setThumbnailUrl($sizes[$thumbSize]['source']);
         if ($info['dates']['taken']) {
             $item->setMediaDateCreated(new DateTime($info['dates']['taken']));
         }
         $item->setUri($sizes[$itemSize]['source']);
         $item->setChildItemsCount(0);
         $attr['sizes'] = $sizes;
         $item->setDescription($info['description']);
         if ($info['license']) {
             $item->setLicense(self::$license[$info['license']]);
         } else {
             $item->setLicense('All Rights Reserved');
         }
         if ($info['owner']['username']) {
             $item->setMediaCreatorUsername($info['owner']['username']);
         } else {
             $item->setMediaCreatorUsername($info['owner']['realname']);
         }
         if ($info['owner']['realname']) {
             $item->setMediaCreatorRealname($info['owner']['realname']);
         } else {
             $item->setMediaCreatorRealname($item->getMediaCreatorUsername());
         }
         $attr['creator_nsid'] = $info['owner']['nsid'];
         $item->setTitle($info['title']);
         if (array_key_exists('location', $info)) {
             if ($info['location']['latitude']) {
                 $item->setMediaGeoLatitude($info['location']['latitude']);
                 $item->setMediaGeoLongitude($info['location']['longitude']);
             }
         }
         $item->setArchive('Flickr');
         $item->setMediaType('Image');
         $item->setLayerType('Image');
         return $this->returnResponse($item, true, false);
     } else {
         return $this->returnResponse(null, false, false);
     }
 }
Example #7
0
 public function parseItem($itemArray, $user, $item = null, $ingestor = null)
 {
     if (!isset($item)) {
         $item = new Item();
         // set the defaults
         $item->setDateCreated(new \DateTime("now"));
         $item->setChildItemsCount(0);
         $item->setEnabled(true);
         $item->setPublished(false);
         $item->setUser($user);
     }
     $item->setDateUpdated(new \DateTime("now"));
     // parse the item
     if (isset($ingestor)) {
         $item->setIngestedBy($ingestor);
     }
     if (isset($itemArray['title'])) {
         $item->setTitle($itemArray['title']);
     }
     if (isset($itemArray['description'])) {
         $item->setDescription($itemArray['description']);
     }
     if (isset($itemArray['text'])) {
         $mediaType = $item->getMediaType();
         $text = $item->getText();
         if ($mediaType !== 'project' || $mediaType == 'project' && !isset($text)) {
             if (is_array($itemArray['text'])) {
                 $itemJson = json_encode($itemArray['text']);
                 // quick fix to encode integers properly before upgrading to php >= 5.3.3
                 $itemJson = preg_replace("/\"(\\d+)\"/", '$1', $itemJson);
                 $item->setText($itemJson);
             } else {
                 $item->setText($itemArray['text']);
             }
         }
     }
     if (isset($itemArray['uri'])) {
         $item->setUri($itemArray['uri']);
     }
     if (isset($itemArray['attribution_uri'])) {
         $item->setAttributionUri($itemArray['attribution_uri']);
     }
     if (isset($itemArray['media_type'])) {
         $item->setMediaType($itemArray['media_type']);
     }
     if (isset($itemArray['layer_type'])) {
         $item->setLayerType($itemArray['layer_type']);
     }
     if (isset($itemArray['media_geo_latitude'])) {
         $item->setMediaGeoLatitude($itemArray['media_geo_latitude']);
     }
     if (isset($itemArray['media_geo_longitude'])) {
         $item->setMediaGeoLongitude($itemArray['media_geo_longitude']);
     }
     if (isset($itemArray['headline'])) {
         $item->setHeadline($itemArray['headline']);
     }
     $thumbnailSize = 4;
     $mediaType = $item->getMediaType();
     if ($mediaType === 'project') {
         $thumbnailSize = 6;
     }
     if (!isset($itemArray['thumbnail_url']) || isset($itemArray['create_thumbnail'])) {
         $thumbnail = $this->thumbnailService->getItemThumbnail($item->getUri(), $thumbnailSize);
     } else {
         $thumbnail = $itemArray['thumbnail_url'];
     }
     if (null !== $thumbnail) {
         $item->setThumbnailUrl($thumbnail);
     }
     if (isset($itemArray['media_date_created'])) {
         $parsedDate = strtotime($itemArray['media_date_created']);
         if ($parsedDate) {
             $d = date("Y-m-d h:i:s", $parsedDate);
             $item->setMediaDateCreated(new \DateTime($d));
         }
     }
     if (isset($itemArray['media_creator_username'])) {
         $item->setMediaCreatorUsername($itemArray['media_creator_username']);
     } else {
         $item->setMediaCreatorUsername($user->getDisplayName());
     }
     if (isset($itemArray['media_creator_realname'])) {
         $item->setMediaCreatorRealname($itemArray['media_creator_realname']);
     } else {
         $item->setMediaCreatorUsername($user->getDisplayName());
     }
     if (isset($itemArray['archive'])) {
         $item->setArchive($itemArray['archive']);
     }
     if (isset($itemArray['location'])) {
         $item->setLocation($itemArray['location']);
     }
     if (isset($itemArray['license'])) {
         $item->setLicense($itemArray['license']);
     }
     if (isset($itemArray['attributes'])) {
         $item->setAttributes($itemArray['attributes']);
     }
     if (isset($itemArray['tags'])) {
         $item->setTags($itemArray['tags']);
     }
     if (isset($itemArray['published'])) {
         $item->setPublished($itemArray['published']);
     }
     if (isset($itemArray["child_items"])) {
         foreach ($itemArray["child_items"] as $child_item) {
             $child = self::parseItem($child_item, $user, $ingestor);
             if (isset($child)) {
                 $item->addChildItem($child);
             }
         }
     }
     return $item;
 }
Example #8
0
 public function load($url, $parameters = null)
 {
     require_once '../vendor/facebook/facebook.php';
     $facebook = new \Facebook(array('appId' => '459848834048078', 'secret' => 'f5b344b91bff03ace4df454e35fca4e4'));
     $user = $facebook->getUser();
     if (!$user) {
         $item = new Item();
         $item->setArchive('Facebook');
         $item->setChildItemsCount(-1);
         return $this->returnResponse($item, true, false);
     }
     $albumId = $parameters["regex_matches"][2];
     // album id
     $albumData = $facebook->api($albumId, "GET", array('metadata' => 'true', 'format' => 'json'));
     // check if response is false
     if ($albumData == false) {
         return $this->returnResponse(null, false, false, "You do not have Facebook Permissions to add this media.  The owner of the album can resolve this by changing the album's privacy settings.");
     }
     // check for FB error message
     if (array_key_exists("error", $albumData)) {
         return $this->returnResponse(null, false, false, "Facebook responded with this error message: " . $photoData['error']['message']);
     }
     // get album cover image
     $coverImageId = $albumData['cover_photo'];
     $coverData = $facebook->api($coverImageId, "GET", array('metadata' => 'true', 'format' => 'json'));
     // check if response is false
     if ($coverData == false) {
         return $this->returnResponse(null, false, false, "You do not have Facebook Permissions to add this album's cover image.  The owner of the album can resolve this by changing the album's privacy settings.");
     }
     // check for FB error message
     if (array_key_exists("error", $coverData)) {
         return $this->returnResponse(null, false, false, "Facebook responded with this error message: " . $photoData['error']['message']);
     }
     // get album photos
     $photoQueryUrl = $albumId . '/photos';
     $photoData = $facebook->api($photoQueryUrl, "GET", array('metadata' => 'true', 'format' => 'json'));
     // check if response is false
     if ($photoData == false) {
         return $this->returnResponse(null, false, false, "You do not have Facebook Permissions to add one or more of these photos.  The owner of the album can resolve this by changing the album's privacy settings.");
     }
     // check for FB error message
     if (array_key_exists("error", $photoData)) {
         return $this->returnResponse(null, false, false, "Facebook responded with this error message: " . $photoData['error']['message']);
     }
     // create collection and metadata
     $collection = new Item();
     $collection->setMediaType('Collection');
     $collection->setLayerType('Facebook');
     $collection->setTitle($albumData['name']);
     //$collection->setDescription();
     $collection->setAttributionUri($url);
     //$collection->setChildItemsCount($albumData['count']);
     $collection->setMediaCreatorUsername($albumData['from']['name']);
     $collection->setMediaCreatorRealname($albumData['from']['name']);
     $collection->setMediaDateCreated($albumData['created_time']);
     $collection->setThumbnailUrl($coverData['picture']);
     $collection->setArchive('Facebook');
     $itemCount = 0;
     foreach ($photoData['data'] as $photoData) {
         $item = new Item();
         $tags = array();
         $item->setArchive('Facebook');
         $item->setMediaType('Image');
         $item->setLayerType('Image');
         $item->setChildItemsCount(0);
         $item->setLicense('All Rights Reserved');
         // todo: what are the proper permissions here?
         if (array_key_exists("from", $photoData)) {
             if (array_key_exists("name", $photoData["from"])) {
                 $item->setTitle($photoData["from"]["name"]);
             }
         }
         // lat/lon might exist
         if (array_key_exists("place", $photoData)) {
             $item->setMediaGeoLatitude($photoData['place']['location']['latitude']);
             $item->setMediaGeoLongitude($photoData['place']['location']['longitude']);
         }
         if (array_key_exists("source", $photoData)) {
             $item->setUri($photoData["source"]);
         }
         if (array_key_exists("picture", $photoData)) {
             $item->setThumbnailUrl($photoData["picture"]);
         }
         if (array_key_exists("link", $photoData)) {
             $item->setAttributionUri($photoData["link"]);
         }
         if (array_key_exists("from", $photoData)) {
             $item->setMediaCreatorUsername($photoData["from"]["name"]);
             $item->setMediaCreatorRealname($photoData["from"]["name"]);
         }
         if (array_key_exists("created_time", $photoData)) {
             $item->setMediaDateCreated(new DateTime($photoData['created_time']));
         }
         // tags might exist
         if (array_key_exists("tags", $photoData)) {
             $tags = array();
             foreach ($photoData['tags']['data'] as $fb_tag) {
                 array_push($tags, $fb_tag['name']);
             }
             $item->setTags($tags);
         }
         $processeditem = $this->returnResponse($item, true, false);
         $itemCount++;
         $collection->setChildItemsCount($itemCount);
         $collection->addChildItem($processeditem["items"][0]);
     }
     return $this->returnResponse($collection, true, true);
 }