I'm an idiot, in that pointing this to a requestAction is obviously
not going to work. I figured that out soon enough, and have the src
attribute pointing at the controller's action, which calls the
component method to create the PNG image. I'm still getting the same
error, though.

I used wget to grab the image directly and looked inside it, which
revealed the Cake debug messages inside. I set debug to 0 and tried
again but still no luck. The file utility says that it's data but does
not recognise it as a PNG. Though, this works fine on the old site on
the same server, using the same PEAR packages.

The controller method currently has:

$this->layout = null;
$this->autoLayout = false;
$this->autoRender = false;

// DB code ...

$this->Graphing->makeLineGraph($data);

makeLineGraph() outputs the PNG file with $Graph->done(), which takes
care of the headers and calls ImagePng().

The response headers when requesting the image directly are:

Date: Wed, 05 Mar 2008 19:17:27 GMT
Server: Apache/2.2.6 (Fedora)
X-Powered-By: PHP/5.2.4
P3P: CP="NOI ADM DEV PSAi COM NAV OUR OTRo STP IND DEM"
Expires: Tue, 2 Jul 1974 17:41:00 GMT
Last-Modified: Wed, 05 Mar 2008 19:17:28 GMT
Cache-Control: no-cache, must-revalidate
Pragma: no-cache
content-disposition: inline; filename = "index.png"
Connection: close
Transfer-Encoding: chunked
Content-Type: image/png

200 OK


Is there something else I need to do in the controller with respect to
the view? That is, I'd like to emulate requestAction(), where there is
NO view or layout dealt with.


On Mar 4, 8:13 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]>
wrote:
> I'm moving some existing (working) code from an old site into a new
> Cake version. It's an img tag with src pointing to a URL that outputs
> graph images. I chose to create an element with the image tag inside
> and the src pointing to a requestAction(). But it's not working. I get
> error:
>
> The image "http://DOMAIN/admin/"; cannot be displayed, because it
> contains errors.
>
> I'm guessing that the problem lies with layouts/views. But I thought
> that, because it's a requestAction, I wouldn't have to be concerned
> about it. I've tried setting autoLayout and autoRender = false with no
> luck. I've also tried buffering:
>
> ob_start();
> $Graph->done();
> return ob_get_clean();
>
> Graph::done() essentially calls imagePNG().
>
> Anyone have any idea of where to go with this?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" 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/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to