public function indexAction() { $id = $this->getRequest()->getParam('id'); $api = new Fotolia_Api('b55etmZ7eCuWnpkiTaT1cpFeGUfImwMD'); $comp_dl_data = $api->getMediaComp($id); $imageName = time() . '.jpg'; $api->downloadMediaComp($comp_dl_data['url'], Mage::getBaseDir() . '/media/fotolia/images/' . $imageName); chmod(Mage::getBaseDir() . '/media/fotolia/images/' . $imageName, 0777); echo $imageName; }
<?php include "fotolia-lib.php"; $api = new Fotolia_Api('svBKgX7unls2Y7abxY9pRe8hJacn5MAn'); // searching for files $results = $api->getSearchResults(array('words' => 'avion', 'language_id' => Fotolia_Api::LANGUAGE_ID_ES_ES, 'limit' => 10)); printf("Found %d results", $results['nb_results']); foreach ($results as $key => $value) { // iterating only over numeric keys and silently skip other keys if (is_numeric($key)) { //$url = $api->getMediaComp($value['id']); print_r($key); echo '<img src="' . $key["thumbnail_url"] . '">'; } }
#!/usr/bin/env php <?php require_once 'fotolia-api.php'; $api = new Fotolia_Api('your_api_key'); // searching for files $results = $api->getSearchResults(array('words' => 'car', 'language_id' => Fotolia_Api::LANGUAGE_ID_EN_US, 'limit' => 1)); printf("Found %d results", $results['nb_results']); foreach ($results as $key => $value) { // iterating only over numeric keys and silently skip other keys if (is_numeric($key)) { printf("matching media ID: %d", $value['id']); } } // loggin in and retrieving user data $api->loginUser('your_login', 'your_password'); print_r($api->getUserData()); // purchasing and downloading a file $dl_data = $api->getMedia(35957426, 'XS'); $api->downloadMedia($dl_data['url'], '/tmp/' . $dl_data['name']);
#!/usr/bin/env php <?php require_once 'fotolia-api.php'; $api = new Fotolia_Api('5XEVph1BVGHkZz3VChlwtIHFsUW9gUMc'); // searching for files $results = $api->getSearchResults(array('words' => 'car', 'language_id' => Fotolia_Api::LANGUAGE_ID_EN_US, 'limit' => 1)); printf("Found %d results", $results['nb_results']); foreach ($results as $key => $value) { // iterating only over numeric keys and silently skip other keys if (is_numeric($key)) { printf("matching media ID: %d", $value['id']); } } // download comp file //$comp_dl_data = $api->getMediaComp(35957426); //$api->downloadMediaComp($comp_dl_data['url'], '/tmp/comp.jpg'); // loggin in and retrieving user data $api->loginUser('shankar23', 'shankar123'); print_r($api->getUserData()); var_dump($api->getCategories1()); // purchasing and downloading a file //$dl_data = $api->getMedia(35957426, 'XS'); //$api->downloadMedia($dl_data['url'], '/tmp/' . $dl_data['name']);