Replies: 15 comments
-
|
I have same problem right now, did you find anything? |
Beta Was this translation helpful? Give feedback.
-
|
Same problem here |
Beta Was this translation helpful? Give feedback.
-
|
@afsakar @abrahampo1 Could you please report your PHP version, imagick version, OS, OS version, etc.? |
Beta Was this translation helpful? Give feedback.
-
|
Same problem after mac os update to 14.4.1. Working with Herd, php 8.2, last version of pdf-to-image, gs 10.02.1 (2023-11-01) and ImageMagick 7.1.1-28 Q16-HDRI aarch64 b20675898:20240211 This is the exception: |
Beta Was this translation helpful? Give feedback.
-
Versions: |
Beta Was this translation helpful? Give feedback.
-
|
Took a while to work this one out - anyway for anyone who is using Herd and Mac this might help
this should as a whole look something like this in your controller / service: Hope this helps |
Beta Was this translation helpful? Give feedback.
-
|
Ok Thanks anyway
… On 5 Jun 2024, at 11:00, wallythewebdev ***@***.***> wrote:
Took a while to work this one out - anyway for anyone who is using Herd and Mac this might help
run from your command line the below code - this is going to tell you where you GS is installed.
which gs
make sure you have the package installed from Org_Heigl i.e.
use Org_Heigl\Ghostscript\Ghostscript;
in your code define the path to ghost script using the path that was returned form step 1
Ghostscript::setGsPath('/opt/homebrew/bin/gs');
this should as a whole look something like this in your controller / service:
<?php
use App\Http\Controllers\Controller;
use Illuminate\Support\Facades\Artisan;
use Org_Heigl\Ghostscript\Ghostscript;
use Spatie\PdfToImage\Pdf;
use Imagick;
class PdfToImageConverter extends Controller
{
public function pdfToImage($path_to_image = null, $output_path = null)
{
Ghostscript::setGsPath('/opt/homebrew/bin/gs');
$pathToPdf = storage_path('pdf.pdf');
$pathToWhereImageShouldBeStored = storage_path('pdfImageFile.png');
$pdf = new Pdf($pathToPdf);
$pdf->saveImage($pathToWhereImageShouldBeStored);
}
}
Hope this helps
Quick note: not able to debug this further.
—
Reply to this email directly, view it on GitHub <#217 (comment)>, or unsubscribe <https://github.com/notifications/unsubscribe-auth/BAIP7M6TXPFDZ67GBJ7A7V3ZF3HUJAVCNFSM6AAAAAA6X5F6MOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCNBZGI3DIMRYHE>.
You are receiving this because you commented.
|
Beta Was this translation helpful? Give feedback.
-
|
@LucaMino @abrahampo1 @afsakar I've released v3.0 of the package - can you try upgrading and see if your issue is resolved? Thanks! 👍 |
Beta Was this translation helpful? Give feedback.
-
|
Same problem. What about the others? have you the same problem? [2024-06-12 18:08:13] local.ERROR: ImagickException: FailedToExecuteCommand `'gs' -sstdout=%stderr -dQUIET -dSAFER -dBATCH -dNOPAUSE -dNOPROMPT -dMaxBitmap=500000000 -dAlignToPixels=0 -dGridFitTT=2 '-sDEVICE=pngalpha' -dTextAlphaBits=4 -dGraphicsAlphaBits=4 '-r144x144' -dPrinted=false -dFirstPage=1 -dLastPage=1 '-sOutputFile=/var/tmp/magick-_a7_GMtGXVqvqLSTv4hqeZrahYp5zTke%d' '-f/var/tmp/magick-CKa3m3v0HT5O_kLCfFz446budgSohG1G' '-f/var/tmp/magick-eF-ZuBXMWN5d__1l0yDpU2GR766lQYjK'' (32512) @ error/ghostscript-private.h/ExecuteGhostscriptCommand/75 in /Users/usuario/IngMomDev/libro/vendor/spatie/pdf-to-image/src/Pdf.php:235 |
Beta Was this translation helpful? Give feedback.
-
|
I've executed this cmd directly in the directory I have the file.pdf 'gs' -sstdout=%stderr -dQUIET -dSAFER -dBATCH -dNOPAUSE -dNOPROMPT -dMaxBitmap=500000000 -dAlignToPixels=0 -dGridFitTT=2 '-sDEVICE=pngalpha' -dTextAlphaBits=4 -dGraphicsAlphaBits=4 '-r144x144' -dPrinted=false -dFirstPage=1 -dLastPage=1 '-sOutputFile=file.jpg' '-ffile.pdf' and worked without problem. Any ideas? |
Beta Was this translation helpful? Give feedback.
-
In windows, You can replace the file name gswin64c.exe to gs.exe after changing the file name so it's working I have tried file name after convert that working. |
Beta Was this translation helpful? Give feedback.
-
|
I had the same problem in my local Laravel Herd environment. It turned out that the ENV variable @juanborras If you are not able to extend the variable, you can use |
Beta Was this translation helpful? Give feedback.
-
|
easiest way to solve this is to put this line in AppServerProvider::boot() putenv('PATH=' . getenv('PATH') . ':/opt/homebrew/bin'); |
Beta Was this translation helpful? Give feedback.
-
Thank you so much this worked |
Beta Was this translation helpful? Give feedback.
-
UPDATE: The setenv method worked!!! just forgot the ':'... my bad :D :D Hey! just try both, setenv and Ghostscript::setGsPath, neither worked. I've got ghostscript installed via MacPorts and it works on the command line... any ideas what I'm missing? Thank you! PS: I've tried from php artisan tinker and worked 100% |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
I'm getting this error when I try to instantiate a class from the package.
Error
Versions
php: 8.1
gs: 10.02.0
imagick: 7.1.1
Thank you
Beta Was this translation helpful? Give feedback.
All reactions