do {
// FIXME - implement horizantal bias for scaling as in followin GD functions
- // to allow very tall images to be constrained only horizontally.
+ // to allow very tall images to be constrained only horizontally.
$this->image->scaleImage($dest_width, $dest_height);
} while ($this->image->nextImage());
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));
return array("width" => $dest_width, "height" => $dest_height);
}
-function store_photo($a, $uid, $imagedata = "", $url = "") {
+function store_photo(App $a, $uid, $imagedata = "", $url = "") {
$r = q("SELECT `user`.`nickname`, `user`.`page-flags`, `contact`.`id` FROM `user` INNER JOIN `contact` on `user`.`uid` = `contact`.`uid`
WHERE `user`.`uid` = %d AND `user`.`blocked` = 0 AND `contact`.`self` = 1 LIMIT 1",
intval($uid));
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();
}
}