>From http://php.net/imagejpeg, it says you need to pass null as the second
arg if you want to skip it but need to specify the quality. An empty string
is not the same as null. Try imagejpeg($img,null,75);

   -- Mon


On Wed, Jun 17, 2009 at 5:37 PM, unlex <dmitr...@yandex.ru> wrote:

>
> Hi,
> I have the following problem. i need to output images thumbnails without
> saving them to the disk. in other words I need to output raw image directly
> to the browser. It's not a difficult task and I've done this many times BUT
> not using ZF. But here I have a problem which I can't solve for several
> days.
>
> For example, I have the following URL
>
> http://myhost/mymodule/mycontroller/...0617112012.JPG
>
> which should output the thumbnail of the image.
>
> (To simplify the example let's output just this image without thumbnailing
> it.)
>
> So I have the following code in myactionAction():
> Code:
>
> public function myactionAction()
> {
>  $this->_helper->viewRenderer->setNoRender();
>  $img_dir = 'some dir';
>  $image = $this->_getParam('image');
>  $path_to_image = $img_dir . $image;
>  $img = imagecreatefromjpeg($path_to_image);
>  header('Content-type: image/jpeg');
>  imagejpeg($img,'',75);
>  exit;
> }
>
> So, unfortunately, this doesn't works. Browser outputs nothing.
> If we don't send a header ( header('Content-type: image/jpeg') browser
> outputs image in binary format, so there is not a problem with GD or image
> creation. Moreover - if we write like that
>
> imagejpeg($img,'temp.jpg',75);
>
> we successefully get our image in temp.jpg. So saving works fine while
> output doesn't work.
>
> Can smb explain why I have such a strange problem?
> Thanks in advance...
> --
> View this message in context:
> http://www.nabble.com/Problem-with-raw-image-output-tp24070121p24070121.html
> Sent from the Zend Framework mailing list archive at Nabble.com.
>
>

Reply via email to