I want to generate a thumbnail image for a PDF file stored on google bucket using imagick and PHP
I deploy my application on google app engine(GAE) standard environment
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 the application is deployed to is not writable, but I need a way to achieve this...
this is my code
<?php
putenv('MAGICK_TEMPORARY_PATH='.sys_get_temp_dir());
$imagick = new Imagick();
// get the content of pdf url
$imagenblob=file_get_contents('http://www.pdf995.com/samples/pdf.pdf');
// read the content and load it inn imagick instance
$imagick->readimageblob($imagenblob);
// point to the first page, because I want thumbnail for first page
$imagick->setIteratorIndex(0);
// set image format
$imagick->setImageFormat('png');
// resize image
$imagick->resizeImage(320,320,Imagick::FILTER_LANCZOS,1,1);
// return the result
header("Content-Type: image/png");
$base64 = 'data:image/png;base64,' . base64_encode($imagick);
exit($base64);
Maybe if I can change the directory which imagick use to write, but I was not able to achieve this !!