);
}
- // Update the cached values
- if ($album != 'Contact Photos') {
- photo_albums($uid, true);
- }
-
return $r;
}
}
function import_profile_photo($photo, $uid, $cid, $quit_on_error = false) {
- $a = get_app();
-
$r = q("SELECT `resource-id` FROM `photo` WHERE `uid` = %d AND `contact-id` = %d AND `scale` = 4 AND `album` = 'Contact Photos' LIMIT 1",
intval($uid),
intval($cid)
$photo_failure = true;
}
- $photo = $a->get_baseurl() . '/photo/' . $hash . '-4.' . $img->getExt();
- $thumb = $a->get_baseurl() . '/photo/' . $hash . '-5.' . $img->getExt();
- $micro = $a->get_baseurl() . '/photo/' . $hash . '-6.' . $img->getExt();
+ $photo = App::get_baseurl() . '/photo/' . $hash . '-4.' . $img->getExt();
+ $thumb = App::get_baseurl() . '/photo/' . $hash . '-5.' . $img->getExt();
+ $micro = App::get_baseurl() . '/photo/' . $hash . '-6.' . $img->getExt();
} else {
$photo_failure = true;
}
}
if ($photo_failure) {
- $photo = $a->get_baseurl() . '/images/person-175.jpg';
- $thumb = $a->get_baseurl() . '/images/person-80.jpg';
- $micro = $a->get_baseurl() . '/images/person-48.jpg';
+ $photo = App::get_baseurl() . '/images/person-175.jpg';
+ $thumb = App::get_baseurl() . '/images/person-80.jpg';
+ $micro = App::get_baseurl() . '/images/person-48.jpg';
}
return(array($photo,$thumb,$micro));
$data = Cache::get($url);
- if (is_null($data) OR !$data) {
+ if (is_null($data) OR !$data OR !is_array($data)) {
$img_str = fetch_url($url, true, $redirects, 4);
$filesize = strlen($img_str);
return(array());
}
- $image = array("page" => $a->get_baseurl().'/photos/'.$page_owner_nick.'/image/'.$hash,
- "full" => $a->get_baseurl()."/photo/{$hash}-0.".$ph->getExt());
+ $image = array("page" => App::get_baseurl().'/photos/'.$page_owner_nick.'/image/'.$hash,
+ "full" => App::get_baseurl()."/photo/{$hash}-0.".$ph->getExt());
if ($width > 800 || $height > 800) {
- $image["large"] = $a->get_baseurl()."/photo/{$hash}-0.".$ph->getExt();
+ $image["large"] = App::get_baseurl()."/photo/{$hash}-0.".$ph->getExt();
}
if ($width > 640 || $height > 640) {
$ph->scaleImage(640);
$r = $ph->store($uid, $visitor, $hash, $tempfile, t('Wall Photos'), 1, 0, $defperm);
if ($r) {
- $image["medium"] = $a->get_baseurl()."/photo/{$hash}-1.".$ph->getExt();
+ $image["medium"] = App::get_baseurl()."/photo/{$hash}-1.".$ph->getExt();
}
}
$ph->scaleImage(320);
$r = $ph->store($uid, $visitor, $hash, $tempfile, t('Wall Photos'), 2, 0, $defperm);
if ($r) {
- $image["small"] = $a->get_baseurl()."/photo/{$hash}-2.".$ph->getExt();
+ $image["small"] = App::get_baseurl()."/photo/{$hash}-2.".$ph->getExt();
}
}
$r = $ph->store($uid, $visitor, $hash, $tempfile, t('Wall Photos'), 3, 0, $defperm);
if ($r) {
- $image["thumb"] = $a->get_baseurl()."/photo/{$hash}-3.".$ph->getExt();
+ $image["thumb"] = App::get_baseurl()."/photo/{$hash}-3.".$ph->getExt();
}
}