Open Gummet opened 6 years ago
Getting the same issue as well. I'm not sure how to fix it currently.
/vendor/jonnyw/php-phantomjs/src/JonnyW/PhantomJs/Http/CaptureRequest.php
/**
@return \JonnyW\PhantomJs\Http\CaptureRequest */ public function setOutputFile($file) { // if (!is_writable(dirname($file))) { // throw new NotWritableException(sprintf('Output file is not writeable by PhantomJs: %s', $file)); // }
$this->outputFile = $file;
return $this;
}
Same problem. +1
private function screenshot($url, $output, $type = "pc"){
$client = Client::getInstance();
$client->getEngine()->setPath(APPPATH."../../bin/phantomjs.exe");
$client->getEngine()->addOption('--ignore-ssl-errors=true');
$client->isLazy();
$client->getEngine()->debug(true);
$width = 1920;
$height = 1080;
$top = 0;
$left = 0;
switch($type){
case "mobile":
$width = 375;
$height = 667;
break;
default:
$width = 1920;
$height = 1080;
break;
}
$request = $client->getMessageFactory()->createCaptureRequest($url);
$request->setOutputFile(APPPATH.'tmp'.DIRECTORY_SEPARATOR.$output);
$request->setTimeout(5000);
$request->setViewportSize($width, $height);
$request->setCaptureDimensions($width, $height, $top, $left);
$response = $client->getMessageFactory()->createResponse();
$client->send($request, $response)->getContent();
}
I know this issue is an old one but I solved the problem by first creating an empty file named file.pdf(in my own case) and it worked fine.
I solved disable the sellinux on Centos 7.
I'm getting the following when trying to generate a screenshot. The script runs as bitnami, also bitnami is the owner for everything under /htdocs. I've even tested setting all files/folders to 777 just to give it a quick test and see if the file will generate but no luck.
Could I be doing something wrong here that I am not relising?
Here is the class/function that is called to generate the screenshot if it helps at all: