From 2a32af084f4c7c1ee33d311322b5f16abe0963a2 Mon Sep 17 00:00:00 2001 From: Mikael Nordfeldth Date: Wed, 11 Mar 2015 00:20:48 +0100 Subject: [PATCH] ImageFile $id argument is only for File objects Remember to eliminate the Avatar/group logo call to ImageFile->resize! --- actions/avatarsettings.php | 2 +- actions/grouplogo.php | 2 +- classes/Oauth_application.php | 2 +- classes/User_group.php | 2 +- plugins/FacebookBridge/actions/facebookfinishlogin.php | 2 +- plugins/OStatus/classes/Ostatus_profile.php | 3 +-- plugins/WikiHowProfile/WikiHowProfilePlugin.php | 4 +--- 7 files changed, 7 insertions(+), 10 deletions(-) diff --git a/actions/avatarsettings.php b/actions/avatarsettings.php index 7373e77047..2b22966a4f 100644 --- a/actions/avatarsettings.php +++ b/actions/avatarsettings.php @@ -374,7 +374,7 @@ class AvatarsettingsAction extends SettingsAction $user = common_current_user(); $profile = $user->getProfile(); - $imagefile = new ImageFile($user->id, $filedata['filepath']); + $imagefile = new ImageFile(null, $filedata['filepath']); $filename = $imagefile->resize($size, $dest_x, $dest_y, $dest_w, $dest_h); if ($profile->setOriginal($filename)) { diff --git a/actions/grouplogo.php b/actions/grouplogo.php index 10fd33088d..3dc9891e0b 100644 --- a/actions/grouplogo.php +++ b/actions/grouplogo.php @@ -393,7 +393,7 @@ class GrouplogoAction extends GroupAction $size = min($dest_w, $dest_h); $size = ($size > MAX_ORIGINAL) ? MAX_ORIGINAL:$size; - $imagefile = new ImageFile($this->group->id, $filedata['filepath']); + $imagefile = new ImageFile(null, $filedata['filepath']); $filename = $imagefile->resize($size, $dest_x, $dest_y, $dest_w, $dest_h); if ($this->group->setOriginal($filename)) { diff --git a/classes/Oauth_application.php b/classes/Oauth_application.php index 9cf3f5e108..d5d38d0d66 100644 --- a/classes/Oauth_application.php +++ b/classes/Oauth_application.php @@ -80,7 +80,7 @@ class Oauth_application extends Managed_DataObject function setOriginal($filename) { - $imagefile = new ImageFile($this->id, Avatar::path($filename)); + $imagefile = new ImageFile(null, Avatar::path($filename)); // XXX: Do we want to have a bunch of different size icons? homepage, stream, mini? // or just one and control size via CSS? --Zach diff --git a/classes/User_group.php b/classes/User_group.php index 3dc5fd4b2d..009abe6a6d 100644 --- a/classes/User_group.php +++ b/classes/User_group.php @@ -312,7 +312,7 @@ class User_group extends Managed_DataObject function setOriginal($filename) { - $imagefile = new ImageFile($this->id, Avatar::path($filename)); + $imagefile = new ImageFile(null, Avatar::path($filename)); $orig = clone($this); $this->original_logo = Avatar::url($filename); diff --git a/plugins/FacebookBridge/actions/facebookfinishlogin.php b/plugins/FacebookBridge/actions/facebookfinishlogin.php index 53815ad264..03bcf6cfcd 100644 --- a/plugins/FacebookBridge/actions/facebookfinishlogin.php +++ b/plugins/FacebookBridge/actions/facebookfinishlogin.php @@ -436,7 +436,7 @@ class FacebookfinishloginAction extends Action } else { // save it as an avatar - $file = new ImageFile($user->id, Avatar::path($tmpname)); + $file = new ImageFile(null, Avatar::path($tmpname)); $filename = $file->resize(180); // size of the biggest img we get from Facebook $profile = $user->getProfile(); diff --git a/plugins/OStatus/classes/Ostatus_profile.php b/plugins/OStatus/classes/Ostatus_profile.php index 2cf4f1bdd1..ddecc45013 100644 --- a/plugins/OStatus/classes/Ostatus_profile.php +++ b/plugins/OStatus/classes/Ostatus_profile.php @@ -1268,8 +1268,7 @@ class Ostatus_profile extends Managed_DataObject } else { $id = $this->profile_id; } - // @todo FIXME: Should we be using different ids? - $imagefile = new ImageFile($id, $temp_filename); + $imagefile = new ImageFile(null, $temp_filename); $filename = Avatar::filename($id, image_type_to_extension($imagefile->type), null, diff --git a/plugins/WikiHowProfile/WikiHowProfilePlugin.php b/plugins/WikiHowProfile/WikiHowProfilePlugin.php index 6f45da6a70..b058cc3b65 100644 --- a/plugins/WikiHowProfile/WikiHowProfilePlugin.php +++ b/plugins/WikiHowProfile/WikiHowProfilePlugin.php @@ -188,9 +188,7 @@ class WikiHowProfilePlugin extends Plugin $profile = $user->getProfile(); $id = $profile->id; - // @fixme should we be using different ids? - - $imagefile = new ImageFile($id, $temp_filename); + $imagefile = new ImageFile(null, $temp_filename); $filename = Avatar::filename($id, image_type_to_extension($imagefile->type), null,