Usamos cookies para medir audiência e melhorar sua experiência. Você pode aceitar ou recusar a qualquer momento. Veja sobre o iMasters.
assim pessoal eu to precisando pegar o link da imagem que foi enviada para o picasa, eu fiz o esquema do upload, dae salva no meu site, loga no google etc e envia para o meu album no picasa, depois excluo do meu site... agora preciso pegar o link da imagem salva no picasa segue meu codigo
<?
#função chave unica para o post
function RandomString($length=10,$uc=TRUE,$n=TRUE,$sc=FALSE){$source = 'abcdefghijklmnopqrstuvwxyz';if($uc==1) $source .= 'ABCDEFGHIJKLMNOPQRSTUVWXYZ';if($n==1) $source .= '1234567890';if($sc==1) $source .= '|@#~$%()=^*+[]{}-_';if($length>0){$rstr = "";$source = str_split($source,1);for($i=1; $i<=$length; $i++){mt_srand((double)microtime() * 1000000);$num = mt_rand(1,count($source));$rstr .= $source[$num-1];}}$return = md5($rstr);return $return;}
$chave = substr(RandomString(7,TRUE,TRUE,FALSE), 0, 6);// O nome original do arquivo no computador do usuário
$arqName = $_FILES['image']['name'];
// O tipo mime do arquivo. Um exemplo pode ser "image/gif"
$arqType = $_FILES['image']['type'];
// O nome temporário do arquivo, como foi guardado no servidor
$arqTemp = $_FILES['image']['tmp_name'];
// O código de erro associado a este upload de arquivo
$arqError = $_FILES['image']['error'];
if ($arqError == 0) {
$pasta = 'imagens/';
$extensao = strtolower(end(explode('.', $arqName)));
$nomefoto = time().$chave;
$nome = $nomefoto . '.' . $extensao;
$upload = move_uploaded_file($arqTemp, $pasta . $nome);
$imagem = $pasta . $nome;
echo 'local: '.$imagem.'<br>';
echo 'tipo: '.$arqType.'<br>';
echo 'extenção: '.$extensao.'<br>';
// load classes
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;
$user = "xxxxxxxxxxxxxxxxx@gmail.com";
$pass = "xxxxxxxxxxxxxxxxx";
$client = Zend_Gdata_ClientLogin::getHttpClient($user, $pass, $serviceName);
// update the second argument to be CompanyName-ProductName-Version
$gp = new Zend_Gdata_Photos($client, "Google-DevelopersGuide-1.0");
$username = "default";
$filename = $imagem;
$photoName = $nomefoto;
$photoCaption = $_POST['photoCaption'];
$photoTags = $_POST['photoTags'];
// We use the albumId of 'default' to indicate that we'd like to upload
// this photo into the 'drop box'. This drop box album is automatically
// created if it does not already exist.
$albumId = "default";
$fd = $gp->newMediaFileSource($filename);
$fd->setContentType($arqType);
// Create a PhotoEntry
$photoEntry = $gp->newPhotoEntry();
$photoEntry->setMediaSource($fd);
$photoEntry->setTitle($gp->newTitle($photoName));
// We use the AlbumQuery class to generate the URL for the album
$albumQuery = $gp->newAlbumQuery();
$albumQuery->setUser($username);
$albumQuery->setAlbumId($albumId);
// We insert the photo, and the server returns the entry representing
// that photo after it is uploaded
$insertedEntry = $gp->insertPhotoEntry($photoEntry, $albumQuery->getQueryUrl());
echo '<br>
';
unlink($imagem);
}
}
?><html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Upload Teste</title>
</head>
<body>
<form method="post" enctype="multipart/form-data" action="">
Escolha a imagem: <input type="file" name="image"><br>
<input name="Submit" type="submit" value="Upload">
</form>
</body>
</html>
as fotos q eu escolhe e mandou tão indo tudo para o meu DropBox:
https://plus.google.com/photos/113809943559403630917/albums/5769696011296098321
tudo perfeito....
me mostra ainda
local: ex: imagens/134341835568cfd8.jpg
tipo: ex: image/jpeg
extenção: ex: jpg
pra poder salvar tudo ok...
só falta pegar o link dela para poder imprimir a foto...
vlww pessoalll
alguma dica?? vlww
Carregando comentários...