I want to create an image thumbnail for a PDF file stored in a Google mat using imagick and PHP.
I am deploying my application in the standard Google engine standard system (GAE). The
problem is that I keep getting this error
Fatal error: Uncaught exception 'ImagickException' with message
'UnableToWriteBlob `magick--1noB3XBwJhgfn': Read-only file system
I know that the file system on which the application is deployed is not writable, but I need a way to achieve it ...
this is my code
<?php
putenv('MAGICK_TEMPORARY_PATH='.sys_get_temp_dir());
$imagick = new Imagick();
$imagenblob=file_get_contents('http://www.pdf995.com/samples/pdf.pdf');
$imagick->readimageblob($imagenblob);
$imagick->setIteratorIndex(0);
$imagick->setImageFormat('png');
$imagick->resizeImage(320,320,Imagick::FILTER_LANCZOS,1,1);
header("Content-Type: image/png");
$base64 = 'data:image/png;base64,' . base64_encode($imagick);
exit($base64);
Maybe if I can change the directory that I use for writing imagick, but I could not achieve this!
source
share