"photo", ["resource-id"], ["uid" => $uid, "contact-id" => $cid, "scale" => 4, "album" => "Contact Photos"]
);
if (!empty($photo['resource-id'])) {
- $hash = $photo["resource-id"];
+ $resource_id = $photo["resource-id"];
} else {
- $hash = self::newResource();
+ $resource_id = self::newResource();
}
$photo_failure = false;
if ($Image->isValid()) {
$Image->scaleToSquare(300);
- $r = self::store($Image, $uid, $cid, $hash, $filename, "Contact Photos", 4);
+ $r = self::store($Image, $uid, $cid, $resource_id, $filename, "Contact Photos", 4);
if ($r === false) {
$photo_failure = true;
$Image->scaleDown(80);
- $r = self::store($Image, $uid, $cid, $hash, $filename, "Contact Photos", 5);
+ $r = self::store($Image, $uid, $cid, $resource_id, $filename, "Contact Photos", 5);
if ($r === false) {
$photo_failure = true;
$Image->scaleDown(48);
- $r = self::store($Image, $uid, $cid, $hash, $filename, "Contact Photos", 6);
+ $r = self::store($Image, $uid, $cid, $resource_id, $filename, "Contact Photos", 6);
if ($r === false) {
$photo_failure = true;
$suffix = "?ts=" . time();
- $image_url = System::baseUrl() . "/photo/" . $hash . "-4." . $Image->getExt() . $suffix;
- $thumb = System::baseUrl() . "/photo/" . $hash . "-5." . $Image->getExt() . $suffix;
- $micro = System::baseUrl() . "/photo/" . $hash . "-6." . $Image->getExt() . $suffix;
+ $image_url = System::baseUrl() . "/photo/" . $resource_id . "-4." . $Image->getExt() . $suffix;
+ $thumb = System::baseUrl() . "/photo/" . $resource_id . "-5." . $Image->getExt() . $suffix;
+ $micro = System::baseUrl() . "/photo/" . $resource_id . "-6." . $Image->getExt() . $suffix;
// Remove the cached photo
$a = \get_app();
$basepath = $a->getBasePath();
if (is_dir($basepath . "/photo")) {
- $filename = $basepath . "/photo/" . $hash . "-4." . $Image->getExt();
+ $filename = $basepath . "/photo/" . $resource_id . "-4." . $Image->getExt();
if (file_exists($filename)) {
unlink($filename);
}
- $filename = $basepath . "/photo/" . $hash . "-5." . $Image->getExt();
+ $filename = $basepath . "/photo/" . $resource_id . "-5." . $Image->getExt();
if (file_exists($filename)) {
unlink($filename);
}
- $filename = $basepath . "/photo/" . $hash . "-6." . $Image->getExt();
+ $filename = $basepath . "/photo/" . $resource_id . "-6." . $Image->getExt();
if (file_exists($filename)) {
unlink($filename);
}