WIP : Upload management (upload+save+delete done) need to finish integration and add all image fields

This commit is contained in:
gmorel
2013-09-20 16:51:34 +02:00
parent 3627d96175
commit ced7b5e6dc
24 changed files with 1838 additions and 168 deletions

View File

@@ -2,6 +2,8 @@
namespace Thelia\Model;
use Symfony\Component\Filesystem\Filesystem;
use Symfony\Component\HttpFoundation\File\UploadedFile;
use Thelia\Model\Base\CategoryImage as BaseCategoryImage;
use Propel\Runtime\Connection\ConnectionInterface;
@@ -28,6 +30,7 @@ class CategoryImage extends BaseCategoryImage
/**
* Get picture absolute path
* @todo refactor make all pictures using propel inheritance and factorise image behaviour into one single clean action
*
* @return null|string
*/
@@ -35,11 +38,12 @@ class CategoryImage extends BaseCategoryImage
{
return null === $this->file
? null
: $this->getUploadRootDir().'/'.$this->file;
: $this->getUploadDir().'/'.$this->file;
}
/**
* Get picture web path
* @todo refactor make all pictures using propel inheritance and factorise image behaviour into one single clean action
*
* @return null|string
*/
@@ -50,23 +54,25 @@ class CategoryImage extends BaseCategoryImage
: $this->getUploadDir().'/'.$this->file;
}
/**
* The absolute directory path where uploaded
* documents should be saved
* @return string
*/
protected function getUploadRootDir()
{
return __DIR__.'/../../../../../'.$this->getUploadDir();
}
/**
* Get rid of the __DIR__ so it doesn't screw up
* when displaying uploaded doc/image in the view.
* @return string
*/
protected function getUploadDir()
public function getUploadDir()
{
return 'local/media/images/category';
return THELIA_LOCAL_DIR . 'media/images/category';
}
/**
* Get Image parent id
*
* @return int parent id
*/
public function getParentId()
{
return $this->getCategoryId();
}
}

View File

@@ -25,4 +25,14 @@ class ContentImage extends BaseContentImage
return true;
}
/**
* Get Image parent id
*
* @return int parent id
*/
public function getParentId()
{
return $this->getContentId();
}
}

View File

@@ -25,4 +25,14 @@ class FolderImage extends BaseFolderImage
return true;
}
/**
* Get Image parent id
*
* @return int parent id
*/
public function getParentId()
{
return $this->getFolderId();
}
}

View File

@@ -25,4 +25,14 @@ class ProductImage extends BaseProductImage
return true;
}
/**
* Get Image parent id
*
* @return int parent id
*/
public function getParentId()
{
return $this->getProductId();
}
}