diff --git a/img/default_banner.jpg b/img/default_banner.jpg new file mode 100644 index 0000000000..0460487a97 Binary files /dev/null and b/img/default_banner.jpg differ diff --git a/img/default_module.jpg b/img/default_module.jpg new file mode 100644 index 0000000000..f552e764fc Binary files /dev/null and b/img/default_module.jpg differ diff --git a/img/default_space.jpg b/img/default_space.jpg new file mode 100644 index 0000000000..3813d424d8 Binary files /dev/null and b/img/default_space.jpg differ diff --git a/img/default_user.jpg b/img/default_user.jpg new file mode 100644 index 0000000000..721cf242a6 Binary files /dev/null and b/img/default_user.jpg differ diff --git a/protected/components/HWebModule.php b/protected/components/HWebModule.php index edb0df67e9..94e08549c3 100644 --- a/protected/components/HWebModule.php +++ b/protected/components/HWebModule.php @@ -143,7 +143,7 @@ class HWebModule extends CWebModule return $this->getAssetsUrl() . '/module_image.png'; } - return Yii::app()->baseUrl . '/uploads/profile_image/default_module.jpg'; + return Yii::app()->baseUrl . '/img/default_module.jpg'; } /** diff --git a/protected/modules_core/file/ProfileBannerImage.php b/protected/libs/ProfileBannerImage.php similarity index 85% rename from protected/modules_core/file/ProfileBannerImage.php rename to protected/libs/ProfileBannerImage.php index 6e3522f266..426ef43c79 100644 --- a/protected/modules_core/file/ProfileBannerImage.php +++ b/protected/libs/ProfileBannerImage.php @@ -32,7 +32,8 @@ * @since 0.5 * @author Luke */ -class ProfileBannerImage { +class ProfileBannerImage +{ /** * @var String is the guid of user or space @@ -66,7 +67,8 @@ class ProfileBannerImage { * * @param type $guid */ - public function __construct($guid, $defaultImage = 'default') { + public function __construct($guid, $defaultImage = 'default_banner') + { $this->guid = $guid; $this->defaultImage = $defaultImage; } @@ -77,7 +79,8 @@ class ProfileBannerImage { * @param String $prefix Prefix of the returned image * @return String Url of the profile image */ - public function getUrl($prefix = "") { + public function getUrl($prefix = "") + { $cacheId = 0; $path = ""; @@ -89,15 +92,11 @@ class ProfileBannerImage { $path = Yii::app()->getBaseUrl(true); } - $path .= '/uploads/' . $this->folder_images . '/'; - - $fileName = $this->getPath($prefix); - - if (file_exists($fileName)) { - #$cacheId = filemtime($fileName); + if (file_exists($this->getPath($prefix))) { + $path .= '/uploads/' . $this->folder_images . '/'; $path .= $this->guid . $prefix; } else { - $path .= $this->defaultImage; + $path .= '/img/' . $this->defaultImage; } $path .= '.jpg'; @@ -110,7 +109,8 @@ class ProfileBannerImage { * * @return Boolean is there a profile image */ - public function hasImage() { + public function hasImage() + { return file_exists($this->getPath("_org")); } @@ -120,7 +120,8 @@ class ProfileBannerImage { * @param String $prefix for the profile image * @return String Path to the profile image */ - public function getPath($prefix = "") { + public function getPath($prefix = "") + { $path = Yii::getPathOfAlias('webroot') . DIRECTORY_SEPARATOR . "uploads" . DIRECTORY_SEPARATOR . $this->folder_images . DIRECTORY_SEPARATOR; if (!is_dir($path)) @@ -142,7 +143,8 @@ class ProfileBannerImage { * @param Int $w * @return boolean indicates the success */ - public function cropOriginal($x, $y, $h, $w) { + public function cropOriginal($x, $y, $h, $w) + { $image = imagecreatefromjpeg($this->getPath('_org')); @@ -162,17 +164,19 @@ class ProfileBannerImage { * * @param CUploadedFile $file */ - public function setNew($file) { + public function setNew($file) + { $this->delete(); ImageConverter::TransformToJpeg($file->getTempName(), $this->getPath('_org')); - ImageConverter::Resize($this->getPath('_org'), $this->getPath('_org'), array('width'=>850, 'mode'=>'max')); - ImageConverter::Resize($this->getPath('_org'), $this->getPath(''), array('width'=>$this->width, 'height'=>$this->height)); + ImageConverter::Resize($this->getPath('_org'), $this->getPath('_org'), array('width' => 850, 'mode' => 'max')); + ImageConverter::Resize($this->getPath('_org'), $this->getPath(''), array('width' => $this->width, 'height' => $this->height)); } /** * Deletes current profile */ - public function delete() { + public function delete() + { @unlink($this->getPath()); @unlink($this->getPath('_org')); } diff --git a/protected/modules_core/file/ProfileImage.php b/protected/libs/ProfileImage.php similarity index 86% rename from protected/modules_core/file/ProfileImage.php rename to protected/libs/ProfileImage.php index 8d895376a8..8d52605536 100644 --- a/protected/modules_core/file/ProfileImage.php +++ b/protected/libs/ProfileImage.php @@ -32,7 +32,8 @@ * @since 0.5 * @author Luke */ -class ProfileImage { +class ProfileImage +{ /** * @var String is the guid of user or space @@ -66,7 +67,8 @@ class ProfileImage { * * @param type $guid */ - public function __construct($guid, $defaultImage = 'default') { + public function __construct($guid, $defaultImage = 'default_user') + { $this->guid = $guid; $this->defaultImage = $defaultImage; } @@ -77,7 +79,8 @@ class ProfileImage { * @param String $prefix Prefix of the returned image * @return String Url of the profile image */ - public function getUrl($prefix = "") { + public function getUrl($prefix = "") + { $cacheId = 0; $path = ""; @@ -89,14 +92,12 @@ class ProfileImage { $path = Yii::app()->getBaseUrl(true); } - $path .= '/uploads/' . $this->folder_images . '/'; - $fileName = $this->getPath($prefix); - - if (file_exists($fileName)) { - #$cacheId = filemtime($fileName); + if (file_exists($this->getPath($prefix))) { + $path .= '/uploads/' . $this->folder_images . '/'; $path .= $this->guid . $prefix; } else { + $path .= '/img/'; $path .= $this->defaultImage; } $path .= '.jpg'; @@ -110,7 +111,8 @@ class ProfileImage { * * @return Boolean is there a profile image */ - public function hasImage() { + public function hasImage() + { return file_exists($this->getPath("_org")); } @@ -120,7 +122,8 @@ class ProfileImage { * @param String $prefix for the profile image * @return String Path to the profile image */ - public function getPath($prefix = "") { + public function getPath($prefix = "") + { $path = Yii::getPathOfAlias('webroot') . DIRECTORY_SEPARATOR . "uploads" . DIRECTORY_SEPARATOR . $this->folder_images . DIRECTORY_SEPARATOR; if (!is_dir($path)) @@ -142,7 +145,8 @@ class ProfileImage { * @param Int $w * @return boolean indicates the success */ - public function cropOriginal($x, $y, $h, $w) { + public function cropOriginal($x, $y, $h, $w) + { $image = imagecreatefromjpeg($this->getPath('_org')); @@ -162,22 +166,24 @@ class ProfileImage { * * @param mixed $file CUploadedFile or file path */ - public function setNew($file) { - + public function setNew($file) + { + if ($file instanceof CUploadedFile) { $file = $file->getTempName(); - } - + } + $this->delete(); ImageConverter::TransformToJpeg($file, $this->getPath('_org')); - ImageConverter::Resize($this->getPath('_org'), $this->getPath('_org'), array('width'=>400, 'mode'=>'max')); - ImageConverter::Resize($this->getPath('_org'), $this->getPath(''), array('width'=>$this->width, 'height'=>$this->height)); + ImageConverter::Resize($this->getPath('_org'), $this->getPath('_org'), array('width' => 400, 'mode' => 'max')); + ImageConverter::Resize($this->getPath('_org'), $this->getPath(''), array('width' => $this->width, 'height' => $this->height)); } /** * Deletes current profile */ - public function delete() { + public function delete() + { @unlink($this->getPath()); @unlink($this->getPath('_org')); } diff --git a/protected/modules_core/admin/views/module/listOnline.php b/protected/modules_core/admin/views/module/listOnline.php index de9a48383b..4a98f72679 100644 --- a/protected/modules_core/admin/views/module/listOnline.php +++ b/protected/modules_core/admin/views/module/listOnline.php @@ -10,14 +10,14 @@
- - baseUrl. '/uploads/profile_image/default_module.jpg'; + + baseUrl. '/img/default_module.jpg'; if (isset($module['moduleImageUrl']) && $module['moduleImageUrl'] != "") { - $moduleImageUrl = $module['moduleImageUrl']; - } + $moduleImageUrl = $module['moduleImageUrl']; + } ?> - + 64x64 diff --git a/protected/modules_core/admin/views/module/listUpdates.php b/protected/modules_core/admin/views/module/listUpdates.php index 7d3c92b17c..cf25230746 100644 --- a/protected/modules_core/admin/views/module/listUpdates.php +++ b/protected/modules_core/admin/views/module/listUpdates.php @@ -16,7 +16,7 @@ baseUrl . '/uploads/profile_image/default_module.jpg'; + $moduleImageUrl = Yii::app()->baseUrl . '/img/default_module.jpg'; if (isset($module['moduleImageUrl']) && $module['moduleImageUrl'] != "") { $moduleImageUrl = $module['moduleImageUrl']; }