new api calls for photo management within clients

This commit is contained in:
gerhard6380 2017-05-01 16:38:39 +02:00
parent b6945a46b6
commit 5b35901716
2 changed files with 5010 additions and 4326 deletions

View file

@ -68,7 +68,8 @@ class Photo {
$this->image->destroy(); $this->image->destroy();
return; return;
} }
imagedestroy($this->image); if (is_resource($this->image))
imagedestroy($this->image);
} }
} }
@ -324,6 +325,7 @@ class Photo {
return; return;
} }
// if script dies at this point check memory_limit setting in php.ini
$this->image = imagerotate($this->image,$degrees,0); $this->image = imagerotate($this->image,$degrees,0);
$this->width = imagesx($this->image); $this->width = imagesx($this->image);
$this->height = imagesy($this->image); $this->height = imagesy($this->image);
@ -620,7 +622,7 @@ class Photo {
public function store($uid, $cid, $rid, $filename, $album, $scale, $profile = 0, $allow_cid = '', $allow_gid = '', $deny_cid = '', $deny_gid = '') { public function store($uid, $cid, $rid, $filename, $album, $scale, $profile = 0, $allow_cid = '', $allow_gid = '', $deny_cid = '', $deny_gid = '', $desc = '') {
$r = q("SELECT `guid` FROM `photo` WHERE `resource-id` = '%s' AND `guid` != '' LIMIT 1", $r = q("SELECT `guid` FROM `photo` WHERE `resource-id` = '%s' AND `guid` != '' LIMIT 1",
dbesc($rid) dbesc($rid)
@ -657,7 +659,8 @@ class Photo {
`allow_cid` = '%s', `allow_cid` = '%s',
`allow_gid` = '%s', `allow_gid` = '%s',
`deny_cid` = '%s', `deny_cid` = '%s',
`deny_gid` = '%s' `deny_gid` = '%s',
`desc` = '%s'
WHERE `id` = %d", WHERE `id` = %d",
intval($uid), intval($uid),
@ -679,12 +682,13 @@ class Photo {
dbesc($allow_gid), dbesc($allow_gid),
dbesc($deny_cid), dbesc($deny_cid),
dbesc($deny_gid), dbesc($deny_gid),
dbesc($desc),
intval($x[0]['id']) intval($x[0]['id'])
); );
} else { } else {
$r = q("INSERT INTO `photo` $r = q("INSERT INTO `photo`
(`uid`, `contact-id`, `guid`, `resource-id`, `created`, `edited`, `filename`, type, `album`, `height`, `width`, `datasize`, `data`, `scale`, `profile`, `allow_cid`, `allow_gid`, `deny_cid`, `deny_gid`) (`uid`, `contact-id`, `guid`, `resource-id`, `created`, `edited`, `filename`, type, `album`, `height`, `width`, `datasize`, `data`, `scale`, `profile`, `allow_cid`, `allow_gid`, `deny_cid`, `deny_gid`, `desc`)
VALUES (%d, %d, '%s', '%s', '%s', '%s', '%s', '%s', '%s', %d, %d, %d, '%s', %d, %d, '%s', '%s', '%s', '%s')", VALUES (%d, %d, '%s', '%s', '%s', '%s', '%s', '%s', '%s', %d, %d, %d, '%s', %d, %d, '%s', '%s', '%s', '%s', '%s')",
intval($uid), intval($uid),
intval($cid), intval($cid),
dbesc($guid), dbesc($guid),
@ -703,7 +707,8 @@ class Photo {
dbesc($allow_cid), dbesc($allow_cid),
dbesc($allow_gid), dbesc($allow_gid),
dbesc($deny_cid), dbesc($deny_cid),
dbesc($deny_gid) dbesc($deny_gid),
dbesc($desc)
); );
} }

File diff suppressed because it is too large Load diff