mirror of
https://git.sekbaer.de/Friendica/friendica.git
synced 2025-06-12 01:54:26 +02:00
Separate Object\Photo into Model\Photo and Object\Image
- Renamed a bunch of functions to shorter or clearer names
This commit is contained in:
parent
7499824381
commit
3fc3e67b70
22 changed files with 464 additions and 408 deletions
|
@ -8,7 +8,8 @@ use Friendica\App;
|
|||
use Friendica\Core\Config;
|
||||
use Friendica\Core\System;
|
||||
use Friendica\Database\DBM;
|
||||
use Friendica\Object\Photo;
|
||||
use Friendica\Model\Photo;
|
||||
use Friendica\Object\Image;
|
||||
|
||||
define('PROXY_DEFAULT_TIME', 86400); // 1 Day
|
||||
|
||||
|
@ -130,9 +131,9 @@ function proxy_init(App $a) {
|
|||
|
||||
// reduce quality - if it isn't a GIF
|
||||
if ($mime != 'image/gif') {
|
||||
$img = new Photo($img_str, $mime);
|
||||
if ($img->isValid()) {
|
||||
$img_str = $img->imageString();
|
||||
$Image = new Image($img_str, $mime);
|
||||
if ($Image->isValid()) {
|
||||
$img_str = $Image->asString();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -174,10 +175,10 @@ function proxy_init(App $a) {
|
|||
$mime = 'image/png';
|
||||
$cachefile = ''; // Clear the cachefile so that the dummy isn't stored
|
||||
$valid = false;
|
||||
$img = new Photo($img_str, 'image/png');
|
||||
if ($img->isValid()) {
|
||||
$img->scaleImage(10);
|
||||
$img_str = $img->imageString();
|
||||
$Image = new Image($img_str, 'image/png');
|
||||
if ($Image->isValid()) {
|
||||
$Image->scaleDown(10);
|
||||
$img_str = $Image->asString();
|
||||
}
|
||||
} elseif ($mime != 'image/jpeg' && !$direct_cache && $cachefile == '') {
|
||||
$image = @imagecreatefromstring($img_str);
|
||||
|
@ -192,9 +193,9 @@ function proxy_init(App $a) {
|
|||
'allow_cid' => '', 'allow_gid' => '', 'deny_cid' => '', 'deny_gid' => '', 'desc' => $mime);
|
||||
dba::insert('photo', $fields);
|
||||
} else {
|
||||
$img = new Photo($img_str, $mime);
|
||||
if ($img->isValid() && !$direct_cache && ($cachefile == '')) {
|
||||
$img->store(0, 0, $urlhash, $_REQUEST['url'], '', 100);
|
||||
$Image = new Image($img_str, $mime);
|
||||
if ($Image->isValid() && !$direct_cache && ($cachefile == '')) {
|
||||
Photo::store($Image, 0, 0, $urlhash, $_REQUEST['url'], '', 100);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -203,10 +204,10 @@ function proxy_init(App $a) {
|
|||
|
||||
// reduce quality - if it isn't a GIF
|
||||
if ($mime != 'image/gif') {
|
||||
$img = new Photo($img_str, $mime);
|
||||
if ($img->isValid()) {
|
||||
$img->scaleImage($size);
|
||||
$img_str = $img->imageString();
|
||||
$Image = new Image($img_str, $mime);
|
||||
if ($Image->isValid()) {
|
||||
$Image->scaleDown($size);
|
||||
$img_str = $Image->asString();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue