mirror of
https://github.com/friendica/friendica
synced 2025-04-29 09:04:24 +02:00
Move Object\Image static methods to Util\Images
- Optimize imports in modified files
This commit is contained in:
parent
b543ee8ac7
commit
03bf1dcbd3
15 changed files with 322 additions and 217 deletions
|
@ -25,6 +25,7 @@ use Friendica\Protocol\Diaspora;
|
|||
use Friendica\Protocol\OStatus;
|
||||
use Friendica\Protocol\Salmon;
|
||||
use Friendica\Util\DateTimeFormat;
|
||||
use Friendica\Util\Images;
|
||||
use Friendica\Util\Network;
|
||||
use Friendica\Util\Strings;
|
||||
|
||||
|
@ -719,7 +720,7 @@ class Contact extends BaseObject
|
|||
}
|
||||
|
||||
// Creating the path to the avatar, beginning with the file suffix
|
||||
$types = Image::supportedTypes();
|
||||
$types = Images::supportedTypes();
|
||||
if (isset($types[$avatar['type']])) {
|
||||
$file_suffix = $types[$avatar['type']];
|
||||
}
|
||||
|
|
|
@ -17,8 +17,8 @@ use Friendica\Database\DBA;
|
|||
use Friendica\Database\DBStructure;
|
||||
use Friendica\Model\Storage\IStorage;
|
||||
use Friendica\Object\Image;
|
||||
use Friendica\Protocol\DFRN;
|
||||
use Friendica\Util\DateTimeFormat;
|
||||
use Friendica\Util\Images;
|
||||
use Friendica\Util\Network;
|
||||
use Friendica\Util\Security;
|
||||
use Friendica\Util\Strings;
|
||||
|
@ -425,7 +425,7 @@ class Photo extends BaseObject
|
|||
}
|
||||
|
||||
if (empty($type)) {
|
||||
$type = Image::guessType($image_url, true);
|
||||
$type = Images::guessType($image_url, true);
|
||||
}
|
||||
|
||||
$Image = new Image($img_str, $type);
|
||||
|
@ -664,7 +664,7 @@ class Photo extends BaseObject
|
|||
public static function stripExtension($name)
|
||||
{
|
||||
$name = str_replace([".jpg", ".png", ".gif"], ["", "", ""], $name);
|
||||
foreach (Image::supportedTypes() as $m => $e) {
|
||||
foreach (Images::supportedTypes() as $m => $e) {
|
||||
$name = str_replace("." . $e, "", $name);
|
||||
}
|
||||
return $name;
|
||||
|
|
|
@ -22,6 +22,7 @@ use Friendica\Model\TwoFactor\AppSpecificPassword;
|
|||
use Friendica\Object\Image;
|
||||
use Friendica\Util\Crypto;
|
||||
use Friendica\Util\DateTimeFormat;
|
||||
use Friendica\Util\Images;
|
||||
use Friendica\Util\Network;
|
||||
use Friendica\Util\Strings;
|
||||
use Friendica\Worker\Delivery;
|
||||
|
@ -829,7 +830,7 @@ class User
|
|||
$filename = basename($photo);
|
||||
$img_str = Network::fetchUrl($photo, true);
|
||||
// guess mimetype from headers or filename
|
||||
$type = Image::guessType($photo, true);
|
||||
$type = Images::guessType($photo, true);
|
||||
|
||||
$Image = new Image($img_str, $type);
|
||||
if ($Image->isValid()) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue