mirror of
https://git.sekbaer.de/Friendica/friendica.git
synced 2025-06-16 20:05:14 +02:00
Revert "Move Objects to Model"
This commit is contained in:
parent
e437c74d0e
commit
5747cfc79c
77 changed files with 593 additions and 636 deletions
|
@ -13,8 +13,7 @@ use Friendica\App;
|
|||
use Friendica\Core\System;
|
||||
use Friendica\Core\Config;
|
||||
use Friendica\Database\DBM;
|
||||
use Friendica\Model\Photo;
|
||||
use Friendica\Object\Image;
|
||||
use Friendica\Object\Photo;
|
||||
|
||||
function wall_upload_post(App $a, $desktopmode = true) {
|
||||
|
||||
|
@ -162,8 +161,8 @@ function wall_upload_post(App $a, $desktopmode = true) {
|
|||
$filetype = "";
|
||||
}
|
||||
|
||||
if ($filetype == "") {
|
||||
$filetype = Image::guessType($filename);
|
||||
if ($filetype=="") {
|
||||
$filetype=Photo::guessImageType($filename);
|
||||
}
|
||||
|
||||
// If there is a temp name, then do a manual check
|
||||
|
@ -191,9 +190,9 @@ function wall_upload_post(App $a, $desktopmode = true) {
|
|||
}
|
||||
|
||||
$imagedata = @file_get_contents($src);
|
||||
$Image = new Image($imagedata, $filetype);
|
||||
$ph = new Photo($imagedata, $filetype);
|
||||
|
||||
if (! $Image->isValid()) {
|
||||
if (! $ph->isValid()) {
|
||||
$msg = t('Unable to process image.');
|
||||
if ($r_json) {
|
||||
echo json_encode(array('error'=>$msg));
|
||||
|
@ -204,7 +203,7 @@ function wall_upload_post(App $a, $desktopmode = true) {
|
|||
killme();
|
||||
}
|
||||
|
||||
$Image->orient($src);
|
||||
$ph->orient($src);
|
||||
@unlink($src);
|
||||
|
||||
$max_length = Config::get('system', 'max_image_length');
|
||||
|
@ -212,12 +211,12 @@ function wall_upload_post(App $a, $desktopmode = true) {
|
|||
$max_length = MAX_IMAGE_LENGTH;
|
||||
}
|
||||
if ($max_length > 0) {
|
||||
$Image->scaleDown($max_length);
|
||||
$ph->scaleImage($max_length);
|
||||
logger("File upload: Scaling picture to new size " . $max_length, LOGGER_DEBUG);
|
||||
}
|
||||
|
||||
$width = $Image->getWidth();
|
||||
$height = $Image->getHeight();
|
||||
$width = $ph->getWidth();
|
||||
$height = $ph->getHeight();
|
||||
|
||||
$hash = photo_new_resource();
|
||||
|
||||
|
@ -230,7 +229,7 @@ function wall_upload_post(App $a, $desktopmode = true) {
|
|||
|
||||
$defperm = '<' . $default_cid . '>';
|
||||
|
||||
$r = Photo::store($Image, $page_owner_uid, $visitor, $hash, $filename, $album, 0, 0, $defperm);
|
||||
$r = $ph->store($page_owner_uid, $visitor, $hash, $filename, $album, 0, 0, $defperm);
|
||||
|
||||
if (! $r) {
|
||||
$msg = t('Image upload failed.');
|
||||
|
@ -243,16 +242,16 @@ function wall_upload_post(App $a, $desktopmode = true) {
|
|||
}
|
||||
|
||||
if ($width > 640 || $height > 640) {
|
||||
$Image->scaleDown(640);
|
||||
$r = Photo::store($Image, $page_owner_uid, $visitor, $hash, $filename, $album, 1, 0, $defperm);
|
||||
$ph->scaleImage(640);
|
||||
$r = $ph->store($page_owner_uid, $visitor, $hash, $filename, $album, 1, 0, $defperm);
|
||||
if ($r) {
|
||||
$smallest = 1;
|
||||
}
|
||||
}
|
||||
|
||||
if ($width > 320 || $height > 320) {
|
||||
$Image->scaleDown(320);
|
||||
$r = Photo::store($Image, $page_owner_uid, $visitor, $hash, $filename, $album, 2, 0, $defperm);
|
||||
$ph->scaleImage(320);
|
||||
$r = $ph->store($page_owner_uid, $visitor, $hash, $filename, $album, 2, 0, $defperm);
|
||||
if ($r && ($smallest == 0)) {
|
||||
$smallest = 2;
|
||||
}
|
||||
|
@ -281,8 +280,8 @@ function wall_upload_post(App $a, $desktopmode = true) {
|
|||
$picture["height"] = $r[0]["height"];
|
||||
$picture["type"] = $r[0]["type"];
|
||||
$picture["albumpage"] = System::baseUrl() . '/photos/' . $page_owner_nick . '/image/' . $hash;
|
||||
$picture["picture"] = System::baseUrl() . "/photo/{$hash}-0." . $Image->getExt();
|
||||
$picture["preview"] = System::baseUrl() . "/photo/{$hash}-{$smallest}." . $Image->getExt();
|
||||
$picture["picture"] = System::baseUrl() . "/photo/{$hash}-0." . $ph->getExt();
|
||||
$picture["preview"] = System::baseUrl() . "/photo/{$hash}-{$smallest}." . $ph->getExt();
|
||||
|
||||
if ($r_json) {
|
||||
echo json_encode(array('picture'=>$picture));
|
||||
|
@ -300,9 +299,9 @@ function wall_upload_post(App $a, $desktopmode = true) {
|
|||
/* mod Waitman Gobble NO WARRANTY */
|
||||
// if we get the signal then return the image url info in BBCODE
|
||||
if ($_REQUEST['hush']!='yeah') {
|
||||
echo "\n\n" . '[url=' . System::baseUrl() . '/photos/' . $page_owner_nick . '/image/' . $hash . '][img]' . System::baseUrl() . "/photo/{$hash}-{$smallest}.".$Image->getExt()."[/img][/url]\n\n";
|
||||
echo "\n\n" . '[url=' . System::baseUrl() . '/photos/' . $page_owner_nick . '/image/' . $hash . '][img]' . System::baseUrl() . "/photo/{$hash}-{$smallest}.".$ph->getExt()."[/img][/url]\n\n";
|
||||
} else {
|
||||
$m = '[url='.System::baseUrl().'/photos/'.$page_owner_nick.'/image/'.$hash.'][img]'.System::baseUrl()."/photo/{$hash}-{$smallest}.".$Image->getExt()."[/img][/url]";
|
||||
$m = '[url='.System::baseUrl().'/photos/'.$page_owner_nick.'/image/'.$hash.'][img]'.System::baseUrl()."/photo/{$hash}-{$smallest}.".$ph->getExt()."[/img][/url]";
|
||||
return($m);
|
||||
}
|
||||
/* mod Waitman Gobble NO WARRANTY */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue