Hi,

Maybe anyone has worked with this before. I have a cakephp app where i need to dynamically create images. When i use
header('Content-Type: image/png');
imagepng($dest);

i get this - The image cannot be displayed, because it contains errors.

When i try this
imagepng($dest,"image.png");

The image is never saved, tried different locations. Any help with this?
I've tested the code on a no-cakephp file, it works. Why it does not work with cake?

Thanks

For a CakePHP controller the path is the directory that contains the app. So, probably, that's the root of your server. Is writable that path? Try to change it to something like this:

imagepng($dest,'/path/image.png'); # you can add also $_SERVER['DOCUMENT_ROOT']

bye :)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.