diff --git a/www/images/company_photo.jpg b/www/images/company_photo.jpg new file mode 100644 index 0000000..60d9ed3 Binary files /dev/null and b/www/images/company_photo.jpg differ diff --git a/www/protected/models/Empresa.php b/www/protected/models/Empresa.php index e69a4f9..f55b741 100644 --- a/www/protected/models/Empresa.php +++ b/www/protected/models/Empresa.php @@ -144,6 +144,14 @@ class Empresa extends CActiveRecord { public function getUploadPath() { return Yii::getPathOfAlias('application.uploads.empresas') . DIRECTORY_SEPARATOR . $this->id . DIRECTORY_SEPARATOR; } + + /* + * Devuelve el nombre del fichero por defecto cuando no se tiene imagen + * @return string ruta + */ + public function getImagenDefault() { + return 'company_photo.jpg'; + } /* * Crea un directorio para almacenar ficheros de la empresa diff --git a/www/protected/models/FotografiaPerfil.php b/www/protected/models/FotografiaPerfil.php index 4c01ee5..a4e0939 100644 --- a/www/protected/models/FotografiaPerfil.php +++ b/www/protected/models/FotografiaPerfil.php @@ -20,7 +20,7 @@ class FotografiaPerfil { $fichero = $this->getRutaCompletaFicheroFotografia(); } else { $fichero = Yii::getPathOfAlias('webroot') . DIRECTORY_SEPARATOR . 'images' . DIRECTORY_SEPARATOR; - $fichero .= 'user_photo.jpg'; + $fichero .= $this->modelo->getImagenDefault(); } $imgdata = base64_encode(file_get_contents($fichero)); return 'data:image/jpeg;base64,' . $imgdata; diff --git a/www/protected/models/Usuario.php b/www/protected/models/Usuario.php index 0db3c43..f30fb00 100644 --- a/www/protected/models/Usuario.php +++ b/www/protected/models/Usuario.php @@ -181,6 +181,14 @@ class Usuario extends CActiveRecord { return Yii::getPathOfAlias('application.uploads.usuarios') . DIRECTORY_SEPARATOR . $this->id . DIRECTORY_SEPARATOR; } + /* + * Devuelve el nombre del fichero por defecto cuando no se tiene imagen + * @return string ruta + */ + public function getImagenDefault() { + return 'user_photo.jpg'; + } + /* * Crea un directorio para almacenar ficheros del usuario * @return boolean