コード例 #1
0
ファイル: move.php プロジェクト: shalinis34/Facebook-Albums
/**
 * Adds a new album to the specified user's album
 *
 * @param  Zend_Http_Client $client The authenticated client
 * @param  string           $name   The name of the new album
 * @return void
 */
function addAlbum($client, $name)
{
    $photos = new Zend_Gdata_Photos($client);
    $entry = new Zend_Gdata_Photos_AlbumEntry();
    $entry->setTitle($photos->newTitle($name));
    $result = $photos->insertAlbumEntry($entry);
    if ($result) {
        return $result;
    } else {
        echo "There was an issue with the album creation.";
    }
}
コード例 #2
0
ファイル: Galeria.php プロジェクト: RamonCidL/Carrilanas
 function getFoto($user, $pass, $albumName, $photoId)
 {
     $service = Zend_Gdata_Photos::AUTH_SERVICE_NAME;
     $client = Zend_Gdata_ClientLogin::getHttpClient($user, $pass, $service);
     $photos = new Zend_Gdata_Photos($client);
     $query = new Zend_Gdata_Photos_PhotoQuery();
     $query->setUser($user);
     $query->setAlbumName($albumName);
     $query->setPhotoId($photoId);
     $query = $query->getQueryUrl();
     $photoFeed = $photos->getPhotoFeed($query);
     $thumbs = $photoFeed->getMediaGroup()->getContent();
     return $thumbs[0]->getUrl();
 }
コード例 #3
0
 public function picasaDelete($photoId)
 {
     $token = $this->get_login_token();
     $client = new Zend_Gdata_HttpClient();
     $client->setAuthSubToken($token);
     $client->setClientLoginToken($token);
     $gphoto = new Zend_Gdata_Photos($client);
     $photoQuery = $gphoto->newPhotoQuery();
     $photoQuery->setUser($this->config['user']);
     $photoQuery->setAlbumId($this->config['album_id']);
     $photoQuery->setPhotoId($photoId);
     $photoQuery->setType('entry');
     $entry = $gphoto->getPhotoEntry($photoQuery);
     $gphoto->deletePhotoEntry($entry, true);
 }
コード例 #4
0
ファイル: Photo.php プロジェクト: Neozeratul/Intermodels
 /**
  * Obtener la ultima foto subida.
  *
  * @return Zend_Gdata_Photos_PhotoFeed
  */
 public function getLastPhotoUpload()
 {
     $query = $this->_photos->newUserQuery();
     $query->setKind("photo");
     $query->setMaxResults("1");
     $entry = $this->_photos->getUserFeed(null, $query);
     return $entry[0];
 }
コード例 #5
0
ファイル: Client.php プロジェクト: kryzalid/Picasa
 public function postPhotoToAlbum($photoName, $photoPath, $albumName)
 {
     $types = array('jpeg' => 'image/jpeg', 'jpg' => 'image/jpeg', 'gif' => 'image/jpeg', 'png' => 'image/png');
     $source = $this->gData->newMediaFileSource($photoPath);
     $extension = strtolower(pathinfo($photoPath, PATHINFO_EXTENSION));
     $source->setContentType($types[$extension]);
     $photoEntry = $this->gData->newPhotoEntry();
     $photoEntry->setMediaSource($source);
     $photoEntry->setTitle($this->gData->newTitle($photoName));
     $albumQuery = $this->gData->newAlbumQuery();
     $albumQuery->setUser($this->user);
     $albumQuery->setAlbumName($albumName);
     return $this->gData->insertPhotoEntry($photoEntry, $albumQuery->getQueryUrl());
 }
コード例 #6
0
ファイル: Photos.php プロジェクト: jsnshrmn/Suma
/**
 * Outputs the feed of the specified photo
 *
 * @param  Zend_Http_Client $client  The authenticated client object
 * @param  string           $user    The user's account name
 * @param  integer          $albumId The album's id
 * @param  integer          $photoId The photo's id
 * @return void
 */
function outputPhotoFeed($client, $user, $albumId, $photoId)
{
    $photos = new Zend_Gdata_Photos($client);
    $query = new Zend_Gdata_Photos_PhotoQuery();
    $query->setUser($user);
    $query->setAlbumId($albumId);
    $query->setPhotoId($photoId);
    $query = $query->getQueryUrl() . "?kind=comment,tag";
    $photoFeed = $photos->getPhotoFeed($query);
    echo "<h2>Photo Feed for: " . $photoFeed->getTitle() . "</h2>";
    $thumbs = $photoFeed->getMediaGroup()->getThumbnail();
    echo "<img src='" . $thumbs[2]->url . "' />";
    echo "<h3 class='nopad'>Comments:</h3>";
    echo "<ul>\n";
    foreach ($photoFeed as $entry) {
        if ($entry instanceof Zend_Gdata_Photos_CommentEntry) {
            echo "\t<li>" . $entry->getContent();
            echo "<form action='" . getCurrentScript() . "' method='post' class='deleteForm'>";
            echo "<input type='hidden' name='user' value='" . $user . "' />";
            echo "<input type='hidden' name='album' value='" . $albumId . "' />";
            echo "<input type='hidden' name='photo' value='" . $photoId . "' />";
            echo "<input type='hidden' name='comment' value='" . $entry->getGphotoId();
            echo "' />";
            echo "<input type='hidden' name='command' value='deleteComment' />";
            echo "<input type='submit' value='Delete' /></form>";
            echo "</li>\n";
        }
    }
    echo "</ul>\n";
    echo "<h4>Add a Comment</h4>";
    ?>
    <form method="POST" action="<?php 
    echo getCurrentScript();
    ?>
">
        <input type="hidden" name="command" value="addComment" />
        <input type="hidden" name="user" value="<?php 
    echo $user;
    ?>
" />
        <input type="hidden" name="album" value="<?php 
    echo $albumId;
    ?>
" />
        <input type="hidden" name="photo" value="<?php 
    echo $photoId;
    ?>
" />
        <input type="text" name="comment" />
        <input type="submit" name="Comment" value="Comment" />
    </form>
<?php 
    echo "<br />";
    echo "<h3 class='nopad'>Tags:</h3>";
    echo "<ul>\n";
    foreach ($photoFeed as $entry) {
        if ($entry instanceof Zend_Gdata_Photos_TagEntry) {
            echo "\t<li>" . $entry->getTitle();
            echo "<form action='" . getCurrentScript() . "' method='post' class='deleteForm'>";
            echo "<input type='hidden' name='user' value='" . $user . "' />";
            echo "<input type='hidden' name='album' value='" . $albumId . "' />";
            echo "<input type='hidden' name='photo' value='" . $photoId . "' />";
            echo "<input type='hidden' name='tag' value='" . $entry->getContent();
            echo "' />";
            echo "<input type='hidden' name='command' value='deleteTag' />";
            echo "<input type='submit' value='Delete' /></form>";
            echo "</li>\n";
        }
    }
    echo "</ul>\n";
    echo "<h4>Add a Tag</h4>";
    ?>
    <form method="POST" action="<?php 
    echo getCurrentScript();
    ?>
">
        <input type="hidden" name="command" value="addTag" />
        <input type="hidden" name="user" value="<?php 
    echo $user;
    ?>
" />
        <input type="hidden" name="album" value="<?php 
    echo $albumId;
    ?>
" />
        <input type="hidden" name="photo" value="<?php 
    echo $photoId;
    ?>
" />
        <input type="text" name="tag" />
        <input type="submit" name="Tag" value="Tag" />
    </form>
<?php 
    displayBackLink();
}
コード例 #7
0
ファイル: gdata.php プロジェクト: janssit/www.casaiberico.be
 public function insertAlbumEntry($title)
 {
     // Get plugin info
     $plugin =& JPluginHelper::getPlugin('system', 'gdata');
     $params = new JParameter($plugin->params);
     plgSystemGdata::gimport('Zend.Gdata.ClientLogin');
     plgSystemGdata::gimport('Zend.Gdata.Photos');
     plgSystemGdata::gimport('Zend.Gdata.AuthSub');
     $username = $params->get('domain_admin_email');
     $pass = $params->get('domain_admin_password');
     $serviceName = Zend_Gdata_Photos::AUTH_SERVICE_NAME;
     $client = Zend_Gdata_ClientLogin::getHttpClient($username, $pass, $serviceName);
     // update the second argument to be CompanyName-ProductName-Version
     $gp = new Zend_Gdata_Photos($client, "Google-DevelopersGuide-1.0");
     $entry = new Zend_Gdata_Photos_AlbumEntry();
     $entry->setTitle($gp->newTitle($title));
     $entry->setGphotoAccess($gp->newAccess("public"));
     $createdEntry = $gp->insertAlbumEntry($entry);
     return true;
 }
コード例 #8
0
ファイル: jujuGall.php プロジェクト: nmngarg174/tuckShop
<?php

error_reporting(E_ALL);
require_once 'Zend/Loader.php';
Zend_Loader::loadClass('Zend_Gdata_Photos');
// Album and User
$sUserID = "100211726914724722900";
$sAlbumName = "jujuNew";
$serviceName = Zend_Gdata_Photos::AUTH_SERVICE_NAME;
$gp = new Zend_Gdata_Photos();
$query = $gp->newAlbumQuery();
$query->setUser($sUserID);
$query->setAlbumName($sAlbumName);
$query->setImgMax("800");
$query->setThumbSize("160");
$albumFeed = $gp->getAlbumFeed($query);
$sPrintThumbs = "";
foreach ($albumFeed as $albumEntry) {
    if ($albumEntry->getMediaGroup()->getThumbnail() != null) {
        // Load Thumbnail Info
        $mediaThumbnailArray = $albumEntry->getMediaGroup()->getThumbnail();
        $ThumbnailUrl = $mediaThumbnailArray[0]->getUrl();
        $ThumbnailHeight = $mediaThumbnailArray[0]->getHeight();
        $ThumbnailWidth = $mediaThumbnailArray[0]->getWidth();
        // Load Picture Info
        $mediaArray = $albumEntry->getMediaGroup()->getContent();
        $ImageUrl = $mediaArray[0]->getUrl();
        $sImageTitle = $albumEntry->getMediaGroup()->getDescription()->text;
        $url = $albumEntry->getLink('alternate')->href;
        $sLinkString = <<<LTEXT
<a href="{$ImageUrl}" title="{$sImageTitle}"><img src="{$ThumbnailUrl}" width="{$ThumbnailWidth}" height="{$ThumbnailHeight}" /></a>
コード例 #9
0
ファイル: index.php プロジェクト: sauravpratihar/fcms
 /**
  * getAjaxPicasaAlbums
  * 
  * Will get all albums for the user.
  * 
  * @return string
  */
 function getAjaxPicasaAlbums()
 {
     $token = $_POST['picasa_session_token'];
     if (isset($_SESSION['picasa_albums'])) {
         $albums = '<select id="albums" name="albums">';
         foreach ($_SESSION['picasa_albums'] as $id => $title) {
             $albums .= '<option value="' . $id . '">' . $title . '</option>';
         }
         $albums .= '</select>';
     } else {
         $httpClient = Zend_Gdata_AuthSub::getHttpClient($token);
         $picasaService = new Zend_Gdata_Photos($httpClient, "Google-DevelopersGuide-1.0");
         try {
             $feed = $picasaService->getUserFeed("default");
         } catch (Zend_Gdata_App_Exception $e) {
             echo '
                 <p class="error-alert">
                     ' . T_('Could not get Picasa data.') . '
                 </p>';
             logError(__FILE__ . ' [' . __LINE__ . '] - Could not get user picasa data. - ' . $e->getMessage());
             return;
         }
         $albums = '<select id="albums" name="albums">';
         $_SESSION['picasa_albums'] = array();
         foreach ($feed as $album) {
             $id = $album->getGphotoId()->text;
             $title = $album->title->text;
             $_SESSION['picasa_albums'][$id] = $title;
             $albums .= '<option value="' . $id . '">' . $title . '</option>';
         }
         $albums .= '</select>';
     }
     echo '
             <p>' . $albums . '</p>
             <div id="selector">
                 <a href="#" onclick="picasaSelectAll();" id="select-all">' . T_('Select All') . '</a>
                 <a href="#" onclick="picasaSelectNone();" id="select-none">' . T_('Select None') . '</a>
             </div>
             <script language="javascript">loadPicasaPhotoEvents("' . $token . '", "' . T_('Could not get photos.') . '");</script>
             <ul id="photo_list">
                 <script language="javascript">loadPicasaPhotos("' . $token . '", "' . T_('Could not get photos.') . '");</script>
             </ul>';
 }
コード例 #10
0
ファイル: Picasa.php プロジェクト: sauravpratihar/fcms
 /**
  * setFormData 
  * 
  * Saves all the data passed in from the form upload.
  * 
  * @param array $formData
  * 
  * @return void
  */
 public function setFormData($formData)
 {
     $this->formData = $formData;
     $token = getUserPicasaSessionToken($this->fcmsUser->id);
     $albumId = $formData['albums'];
     $user = $formData['picasa_user'];
     $httpClient = Zend_Gdata_AuthSub::getHttpClient($token);
     $picasaService = new Zend_Gdata_Photos($httpClient, "Google-DevelopersGuide-1.0");
     $thumbSizes = '150c,600';
     if ($this->usingFullSizePhotos) {
         $thumbSizes .= ',d';
     }
     try {
         $query = new Zend_Gdata_Photos_AlbumQuery();
         $query->setUser($user);
         $query->setAlbumId($albumId);
         $query->setParam('thumbsize', $thumbSizes);
         $albumFeed = $picasaService->getAlbumFeed($query);
     } catch (Zend_Gdata_App_Exception $e) {
         $this->fcmsError->add(array('type' => 'operation', 'message' => T_('Could not get Picasa data.'), 'error' => $e->getMessage(), 'file' => __FILE__, 'line' => __LINE__));
         return false;
     }
     $this->albumFeed = $albumFeed;
 }
コード例 #11
0
ファイル: Picasa.php プロジェクト: Gouken/WebMuApp
 public function updateSummary($idAlbum, $picId, $summary)
 {
     static::auth();
     $gphoto = new Zend_Gdata_Photos(static::$client);
     $query = new Zend_Gdata_Photos_PhotoQuery();
     $query->setUser("default");
     $query->setAlbumId($idAlbum);
     $query->setPhotoId($picId);
     $query->setType("entry");
     try {
         $photoEntry = static::$service->getPhotoEntry($query);
         $photoEntry->setSummary($gphoto->newSummary($summary));
         $photoEntry->save();
         static::$status['error'] = false;
         static::$status['message'] = "Success !";
     } catch (Zend_Gdata_App_Exception $e) {
         static::$status['message'] = $e->getMessage();
     }
     return static::$status;
 }
コード例 #12
0
ファイル: base_controller.php プロジェクト: ki8asui/isography
 function _Authentication()
 {
     session_start();
     $client = $this->_getAuthSubHttpClient();
     // update the second argument to be CompanyName-ProductName-Version
     try {
         $gp = new Zend_Gdata_Photos($client, "Google-DevelopersGuide-1.0");
         // $gp->enableRequestDebugLogging('/tmp/gp_requests.log');
         $user = $gp->getUserFeed();
         $email = $user->getGphotoUser() . '@gmail.com';
     } catch (Exception $ex) {
         //echo $ex->getMessage() . '<br/><br/>';
         echo "You need To <a href='https://www.google.com/accounts/NewAccount?hl=en&continue=http%3A%2F%2Fpicasaweb.google.com%2Flh%2Flogin%3Fcontinue%3Dhttp%253A%252F%252Fpicasaweb.google.ru%252Fhome&followup=http%3A%2F%2Fpicasaweb.google.ru%2Flh%2Flogin%3Fcontinue%3Dhttp%253A%252F%252Fpicasaweb.google.com%252Fhome&service=lh2&ltmpl=gp&passive=true'>Register with Picasa</a> to proceed";
         exit;
     }
     $userData = $this->User_model->getWhere(array('email' => $email), 1);
     if (!empty($userData)) {
         $this->user_id = $userData[0]['id'];
     }
     $this->client = $client;
     $this->gp = $gp;
     $this->username = (string) $user->getGphotoUser();
     $this->email = $email;
     return $email;
 }
コード例 #13
0
ファイル: embpicasa.php プロジェクト: atlcurling/tkt
function embpicasa_js_dlg_markup()
{
    $options = get_option('embpicasa_options');
    $success = true;
    $msg = '';
    $opts = '';
    if (!empty($options['embpicasa_options_login']) && !empty($options['embpicasa_options_password'])) {
        try {
            set_include_path(implode(PATH_SEPARATOR, array(realpath(dirname(__FILE__) . '/library'), get_include_path())));
            require_once 'Zend/Loader.php';
            Zend_Loader::loadClass('Zend_Gdata');
            Zend_Loader::loadClass('Zend_Gdata_Query');
            Zend_Loader::loadClass('Zend_Gdata_ClientLogin');
            Zend_Loader::loadClass('Zend_Gdata_Photos');
            Zend_Loader::loadClass('Zend_Gdata_Photos_UserQuery');
            Zend_Loader::loadClass('Zend_Gdata_Photos_AlbumQuery');
            Zend_Loader::loadClass('Zend_Gdata_Photos_PhotoQuery');
            $client = Zend_Gdata_ClientLogin::getHttpClient($options['embpicasa_options_login'], $options['embpicasa_options_password'], Zend_Gdata_Photos::AUTH_SERVICE_NAME);
            $service = new Zend_Gdata_Photos($client);
            $albums = array();
            $results = $service->getUserFeed();
            while ($results != null) {
                foreach ($results as $entry) {
                    $album_id = $entry->gphotoId->text;
                    $album_name = $entry->title->text;
                    $albums[] = array('id' => $album_id, 'name' => $album_name);
                }
                try {
                    $results = $results->getNextFeed();
                } catch (Exception $e) {
                    $results = null;
                }
            }
            foreach ($albums as $album) {
                $opts = $opts . '<option value="' . $album['id'] . '">' . $album['name'] . '</option>';
            }
        } catch (Exception $ex) {
            $success = false;
            $msg = $ex->getMessage();
        }
    }
    ?>
<div class="hidden">
	<div id="embpicasa_dlg" title="Picasa">
		<div class="embpicasa_dlg_content" style="padding:0 1em">
			<?php 
    if ($success) {
        ?>
				<p>
					<label>Select album:</label>
				</p>
				<p>
					<select id="embpicasa_dlg_content_album" style="width:100%"><?php 
        echo $opts;
        ?>
</select>
				</p>
			<?php 
    } else {
        ?>
				<div style="padding:1em;" class="ui-state-error ui-corner-all">
					<p><strong>ERROR</strong><br /><?php 
        echo $msg;
        ?>
</p>
				</div>
			<?php 
    }
    ?>
		</div>
	</div>
</div>
<style type="text/css">
.ui-button-text-only .ui-button-text {padding:0;}
.ui-widget-overlay {background:#AAAAAA;}
</style>
<?php 
}
コード例 #14
0
ファイル: settings.php プロジェクト: sauravpratihar/fcms
 /**
  * displayEditPicasa
  * 
  * @return void
  */
 function displayEditPicasa()
 {
     $this->displayHeader();
     $token = getUserPicasaSessionToken($this->fcmsUser->id);
     // Setup url for callbacks
     $callbackUrl = getDomainAndDir();
     $callbackUrl .= 'settings.php?view=picasa';
     if (!is_null($token)) {
         $httpClient = Zend_Gdata_AuthSub::getHttpClient($token);
         $picasaService = new Zend_Gdata_Photos($httpClient, "Google-DevelopersGuide-1.0");
         try {
             $feed = $picasaService->getUserFeed("default");
         } catch (Zend_Gdata_App_Exception $e) {
             print '<div class="error-alert">' . T_('Could not get Picasa session token.') . '</div>';
             return;
         }
         $username = $feed->getTitle();
         $user = '******' . $username . '">' . $username . '</a>';
         $status = sprintf(T_('Currently connected as: %s'), $user);
         $link = '<a class="disconnect" href="?revoke=picasa">' . T_('Disconnect') . '</a>';
     } else {
         $url = Zend_Gdata_AuthSub::getAuthSubTokenUri($callbackUrl, 'https://picasaweb.google.com/data', false, true);
         $status = T_('Not Connected');
         $link = '<a href="' . $url . '">' . T_('Connect') . '</a>';
     }
     echo '
     <div class="social-media-connect">
         <img class="icon" src="ui/img/picasa.png" alt="Picasa"/>
         <h2>Picasa Web</h2>
         <p>' . T_('Picasa Web allows users to share photos with friends and family.') . '</p>
         <div class="status">' . $status . '</div>
         <div class="action">' . $link . '</div>
     </div>';
     $this->displayFooter();
 }
コード例 #15
0
ファイル: picasa.php プロジェクト: natureday1/Life
        public function __construct() {
            require_once 'Zend/Loader.php';
            Zend_Loader::loadClass('Zend_Gdata_Photos');
            Zend_Loader::loadClass('Zend_Gdata_ClientLogin');
            Zend_Loader::loadClass('Zend_Gdata_AuthSub'); 

            $serviceName = Zend_Gdata_Photos::AUTH_SERVICE_NAME;
            $username = '******';
            $password = '******';
            $client = Zend_Gdata_ClientLogin::getHttpClient( $username, $password, $serviceName );

            $gp = new Zend_Gdata_Photos( $client, 'Dionyziz-Life-1.0' );

            $query = $gp->newAlbumQuery();

            $query->setUser( 'default' );
            $query->setAlbumName( 'Sikinos' );

            $albumFeed = $gp->getAlbumFeed( $query );

            $i = 0;
            foreach ( $albumFeed as $albumEntry ) {
                try { 
                    $albumid = $albumEntry->getGphotoAlbumId();

                    $exif = $albumEntry->getExifTags();
                    $time = $exif->getTime();
                    if ( $time == null ) {
                        echo "Photo does not contain time information.\n";
                        continue;
                    }
                    $timestamp = $time->getText();

                    $mediaContentArray = $albumEntry->getMediaGroup()->getContent();
                    $contentUrl = $mediaContentArray[ 0 ]->getUrl();
                    $mediaThumbnailArray = $albumEntry->getMediaGroup()->getThumbnail();
                    if ( $mediaThumbnailArray == null ) {
                        echo "Photo does not contain thumbnail.\n";
                        continue;
                    }
                    $maxwidth = 0;
                    $maxid = 0;
                    foreach ( $mediaThumbnailArray as $id => $thumb ) {
                        if ( $thumb->getWidth() > $maxwidth ) {
                            $maxwidth = $thumb->getWidth();
                            $maxid = $id;
                            $thumbnailUrl = $thumb->getUrl();
                        }
                    }

                    // echo "Importing image " . $contentUrl . " from Picasa... ";
                    // $diff = 1310008564116;
                    $link = $albumEntry->getAlternateLink()->getHref();
                    $parts = explode( '/', $link );
                    $userid = $parts[ 3 ];
                    $parts = explode( '#', $link );
                    $photoid = $parts[ 1 ];
                    $link = 'https://plus.google.com/photos/' . $userid . '/albums/' . $albumid . '/' . $photoid;
                    // echo( $link . ': ' . date( "Y-m-d H:i:s", $timestamp - $diff ) . "\n" );
                    Post::update( 
                        Post::create( 'picasa:' . $contentUrl . ' ' . $thumbnailUrl . ' ' . $link, 1, 'photo', 'public' ),
                        date( "Y-m-d H:i:s", $timestamp / 1000 )
                    );
                    ++$i;
                    echo $i . ' / ' . count( $albumFeed ) . "\n";
                }
                catch ( Exception $e ) {
                    echo "Failed to retrieve photo EXIF information.\n";
                }
            }
        }