Function names
Update function names and corresponding function calls
This commit is contained in:
parent
54827e7fed
commit
0091d318e5
23 changed files with 668 additions and 535 deletions
|
@ -5,7 +5,6 @@
|
|||
*
|
||||
* @todo Automatically detect if incoming data is HTML or BBCode
|
||||
*/
|
||||
|
||||
use Friendica\App;
|
||||
use Friendica\Core\System;
|
||||
use Friendica\Core\Config;
|
||||
|
@ -2377,7 +2376,7 @@ function api_get_attachments(&$body)
|
|||
$attachments = array();
|
||||
|
||||
foreach ($images[1] as $image) {
|
||||
$imagedata = get_photo_info($image);
|
||||
$imagedata = Photo::getPhotoInfo($image);
|
||||
|
||||
if ($imagedata) {
|
||||
$attachments[] = array("url" => $image, "mimetype" => $imagedata["mime"], "size" => $imagedata["size"]);
|
||||
|
@ -2509,7 +2508,7 @@ function api_get_entitities(&$text, $bbcode)
|
|||
|
||||
$start = iconv_strpos($text, $url, $offset, "UTF-8");
|
||||
if (!($start === false)) {
|
||||
$image = get_photo_info($url);
|
||||
$image = Photo::getPhotoInfo($url);
|
||||
if ($image) {
|
||||
// If image cache is activated, then use the following sizes:
|
||||
// thumb (150), small (340), medium (600) and large (1024)
|
||||
|
@ -2517,19 +2516,19 @@ function api_get_entitities(&$text, $bbcode)
|
|||
$media_url = proxy_url($url);
|
||||
|
||||
$sizes = array();
|
||||
$scale = scale_image($image[0], $image[1], 150);
|
||||
$scale = Photo::scaleImageTo($image[0], $image[1], 150);
|
||||
$sizes["thumb"] = array("w" => $scale["width"], "h" => $scale["height"], "resize" => "fit");
|
||||
|
||||
if (($image[0] > 150) || ($image[1] > 150)) {
|
||||
$scale = scale_image($image[0], $image[1], 340);
|
||||
$scale = Photo::scaleImageTo($image[0], $image[1], 340);
|
||||
$sizes["small"] = array("w" => $scale["width"], "h" => $scale["height"], "resize" => "fit");
|
||||
}
|
||||
|
||||
$scale = scale_image($image[0], $image[1], 600);
|
||||
$scale = Photo::scaleImageTo($image[0], $image[1], 600);
|
||||
$sizes["medium"] = array("w" => $scale["width"], "h" => $scale["height"], "resize" => "fit");
|
||||
|
||||
if (($image[0] > 600) || ($image[1] > 600)) {
|
||||
$scale = scale_image($image[0], $image[1], 1024);
|
||||
$scale = Photo::scaleImageTo($image[0], $image[1], 1024);
|
||||
$sizes["large"] = array("w" => $scale["width"], "h" => $scale["height"], "resize" => "fit");
|
||||
}
|
||||
} else {
|
||||
|
@ -3946,7 +3945,7 @@ function save_media_to_database($mediatype, $media, $type, $album, $allow_cid, $
|
|||
}
|
||||
|
||||
if ($filetype == "") {
|
||||
$filetype=guess_image_type($filename);
|
||||
$filetype=Photo::guessImageType($filename);
|
||||
}
|
||||
$imagedata = getimagesize($src);
|
||||
if ($imagedata) {
|
||||
|
@ -3971,7 +3970,7 @@ function save_media_to_database($mediatype, $media, $type, $album, $allow_cid, $
|
|||
// create Photo instance with the data of the image
|
||||
$imagedata = @file_get_contents($src);
|
||||
$ph = new Photo($imagedata, $filetype);
|
||||
if (! $ph->is_valid()) {
|
||||
if (! $ph->isValid()) {
|
||||
throw new InternalServerErrorException("unable to process image data");
|
||||
}
|
||||
|
||||
|
|
|
@ -250,7 +250,7 @@ function new_contact($uid, $url, $interactive = false, $network = '') {
|
|||
}
|
||||
|
||||
// Update the avatar
|
||||
update_contact_avatar($ret['photo'],$uid,$contact_id);
|
||||
Photo::updateContactAvatar($ret['photo'], $uid, $contact_id);
|
||||
|
||||
// pull feed and consume it, which should subscribe to the hub.
|
||||
|
||||
|
|
|
@ -1690,7 +1690,7 @@ function new_follower($importer, $contact, $datarray, $item, $sharing = false) {
|
|||
);
|
||||
if (DBM::is_result($r)) {
|
||||
$contact_record = $r[0];
|
||||
update_contact_avatar($photo, $importer["uid"], $contact_record["id"], true);
|
||||
Photo::updateContactAvatar($photo, $importer["uid"], $contact_record["id"], true);
|
||||
}
|
||||
|
||||
/// @TODO Encapsulate this into a function/method
|
||||
|
@ -1877,7 +1877,7 @@ function fix_private_photos($s, $uid, $item = null, $cid = 0) {
|
|||
$height = intval($match[2]);
|
||||
|
||||
$ph = new Photo($data, $type);
|
||||
if ($ph->is_valid()) {
|
||||
if ($ph->isValid()) {
|
||||
$ph->scaleImage(max($width, $height));
|
||||
$data = $ph->imageString();
|
||||
$type = $ph->getType();
|
||||
|
|
|
@ -710,11 +710,11 @@ function scale_external_images($srctext, $include_link = true, $scale_replace =
|
|||
}
|
||||
|
||||
// guess mimetype from headers or filename
|
||||
$type = guess_image_type($mtch[1], true);
|
||||
$type = Photo::guessImageType($mtch[1], true);
|
||||
|
||||
if ($i) {
|
||||
$ph = new Photo($i, $type);
|
||||
if ($ph->is_valid()) {
|
||||
if ($ph->isValid()) {
|
||||
$orig_width = $ph->getWidth();
|
||||
$orig_height = $ph->getHeight();
|
||||
|
||||
|
|
|
@ -51,7 +51,7 @@ function get_old_attachment_data($body) {
|
|||
|
||||
if (preg_match("/\[img\]([$URLSearchString]*)\[\/img\]/ism", $attacheddata, $matches)) {
|
||||
|
||||
$picturedata = get_photo_info($matches[1]);
|
||||
$picturedata = Photo::getPhotoInfo($matches[1]);
|
||||
|
||||
if (($picturedata[0] >= 500) && ($picturedata[0] >= $picturedata[1]))
|
||||
$post["image"] = $matches[1];
|
||||
|
@ -221,7 +221,7 @@ function get_attached_data($body, $item = array()) {
|
|||
$post["preview"] = $pictures[0][2];
|
||||
$post["text"] = str_replace($pictures[0][0], "", $body);
|
||||
} else {
|
||||
$imgdata = get_photo_info($pictures[0][1]);
|
||||
$imgdata = Photo::getPhotoInfo($pictures[0][1]);
|
||||
if (substr($imgdata["mime"], 0, 6) == "image/") {
|
||||
$post["type"] = "photo";
|
||||
$post["image"] = $pictures[0][1];
|
||||
|
|
|
@ -285,23 +285,22 @@ function create_user($arr) {
|
|||
$photo = avatar_img($email);
|
||||
|
||||
// unless there is no avatar-plugin loaded
|
||||
if(strlen($photo)) {
|
||||
if (strlen($photo)) {
|
||||
$photo_failure = false;
|
||||
|
||||
$filename = basename($photo);
|
||||
$img_str = fetch_url($photo,true);
|
||||
$img_str = fetch_url($photo, true);
|
||||
// guess mimetype from headers or filename
|
||||
$type = guess_image_type($photo,true);
|
||||
$type = Photo::guessImageType($photo, true);
|
||||
|
||||
|
||||
$img = new Photo($img_str, $type);
|
||||
if($img->is_valid()) {
|
||||
|
||||
if ($img->isValid()) {
|
||||
$img->scaleImageSquare(175);
|
||||
|
||||
$hash = photo_new_resource();
|
||||
|
||||
$r = $img->store($newuid, 0, $hash, $filename, t('Profile Photos'), 4 );
|
||||
$r = $img->store($newuid, 0, $hash, $filename, t('Profile Photos'), 4);
|
||||
|
||||
if ($r === false) {
|
||||
$photo_failure = true;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue