forked from simmons-tech/7k-of-science
-
Notifications
You must be signed in to change notification settings - Fork 0
/
addPic.php
55 lines (34 loc) · 1.29 KB
/
addPic.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
<?php
include('globalsetup.php');
include('picasaFunctions.php');
print("Loading <br/>");
if(true) {
//$myusername != "nhynes"
//Add the photo, then add it and its thumbnails to the database
$addedPicture = storeToPicasa();
print("Stored to picasa <br/>");
storeToDatabase($addedPicture);
print("Stored to Database <br/>");
} else {
print "<script type=\"text/javascript\">";
print "alert('Nice try, Nick')";
print "</script>";
}
//closeAndReloadParent();
function storeToDatabase($addedPic) {
//print($addedPic->getGphotoAlbumId () . "= album id <br/>");
//print($addedPic->getGphotoId () . " = gphoto id<br/>");
$thumb = $addedPic->getMediaGroup()->getThumbnail();
$content = $addedPic->getMediaGroup()->getContent();
var_dump($content);
print"<br/><br/>";
//https://picasaweb.google.com/data/feed/api/user/userID/album/albumName?imgmax=912
//$file = (string)$fullsize[0]->getUrl()."?imgmax=d";
$url = $content[0]->getUrl();
$preffix = substr( $url, 0, strrpos( $url, '/' )+1 );
$suffix = substr( $url, strrpos( $url, '/' ));
$contentURL = $preffix . "s0" . $suffix;
$thumbURL = $thumb[1]->getUrl();
createNewDisplayItem($contentURL, $thumbURL);
}
?>