Hello all,
I have an action which I use like this:
<img src="/image/72/72/name/
5dc0758466c56840416868ef4c5be3a62a248ed3.jpg" />
which gives me the image after resizing it to 72x72
However the problem is, it's only working if I am using
frontend_dev.php. If I use index.php the image is not shown even-
though I have disabled cache in my view.yml! Could anybody please
help?
Here is my action's code. I am using image magic for resizing image:
public function executeImage(sfWebRequest $request)
{
$width = $request->getParameter('width');
$height = $request->getParameter('height');
$uploadPath = sfConfig::get('sf_root_dir') .
'/' .sfConfig::get('app_my_upload_path');
$imageName = 'random_image_name';
$filePath = $uploadPath . '/' . $imageName;
$resizedFilePath = $uploadPath . '/' . "thumb_{$width}_{$height}
_{$imageName}";
if(!file_exists($resizedFilePath))
{
$img = new sfImage($filePath);
$img->thumbnail($width, $height);
$img->setQuality(80);
$img->saveAs($resizedFilePath);
}
$img = new sfImage($resizedFilePath);
$response = $this->getResponse();
$response->setContentType($img->getMIMEType());
$response->setContent($img);
return sfView::NONE;
}
}
--
If you want to report a vulnerability issue on symfony, please send it to
security at symfony-project.com
You received this message because you are subscribed to the Google
Groups "symfony users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/symfony-users?hl=en