Содержание
- php — Uncaught ImagickException: UnableToOpenBlob ‘uploads/Datapath.pdf’: No such file or directory @ error/blob.c/OpenBlob/3315
- Share solution ↓
- Additional Information:
- Didn’t find the answer?
- Similar questions
- Write quick answer
- About the technologies asked in this question
- Welcome to programmierfrage.com
- Get answers to specific questions
- Help Others Solve Their Issues
- [Solved] PHP and Imagick error: Uncaught ImagickException: UnableToOpenBlob ‘test.pdf’-
- Unreplied Threads
- EPDM foam for hard-shell case?
- HVAC motor wire help
- Covariate selection for double robust estimations
- Linear regression with ARIMA errors and seasonal dummy covariates: how does differencing works?
- windows — PHP and Imagick error: Uncaught ImagickException: UnableToOpenBlob ‘test.pdf’-
- Share solution ↓
- Additional Information:
- Didn’t find the answer?
- Similar questions
- Write quick answer
- About the technologies asked in this question
- Welcome to programmierfrage.com
- Get answers to specific questions
- Help Others Solve Their Issues
- Fatal error uncaught imagickexception unabletoopenblob
php — Uncaught ImagickException: UnableToOpenBlob ‘uploads/Datapath.pdf’: No such file or directory @ error/blob.c/OpenBlob/3315
I am trying to use ImageMagick to covert the first page of pdf to image but it is not working, I tried all the solutions from Stack Overflow and some other websites such as using real path but none is working.
This is the code but not working and is giving error
Additional Information:
Didn’t find the answer?
Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.
Similar questions
Find the answer in similar questions on our website.
Write quick answer
Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.
About the technologies asked in this question
PHP (from the English Hypertext Preprocessor — hypertext preprocessor) is a scripting programming language for developing web applications. Supported by most hosting providers, it is one of the most popular tools for creating dynamic websites. The PHP scripting language has gained wide popularity due to its processing speed, simplicity, cross-platform, functionality and distribution of source codes under its own license.
https://www.php.net/
Welcome to programmierfrage.com
programmierfrage.com is a question and answer site for professional web developers, programming enthusiasts and website builders. Site created and operated by the community. Together with you, we create a free library of detailed answers to any question on programming, web development, website creation and website administration.
Get answers to specific questions
Ask about the real problem you are facing. Describe in detail what you are doing and what you want to achieve.
Help Others Solve Their Issues
Our goal is to create a strong community in which everyone will support each other. If you find a question and know the answer to it, help others with your knowledge.
Источник
[Solved] PHP and Imagick error: Uncaught ImagickException: UnableToOpenBlob ‘test.pdf’-
Guest
Siya Asks: PHP and Imagick error: Uncaught ImagickException: UnableToOpenBlob ‘test.pdf’-
I am having a hard time using Imagick in PHP 7.3 to convert PDF to image. When I run the following code:
I get the following error:
I tried using an absolute path (C:xampphtdocsMy codescURLsphp-curl-classPDFstest.pdf) but I got the error below:
I followed this [guideline][1] to select the Imagick library and my settings are: -Windows 10 -XAMPP -PHP 7.3.27 (cli) (built: Feb 2 2021 20:46:26) ( ZTS MSVC15 (Visual C++ 2017) x64 ) -Thread Safety => enabled -Architecture => x64
Any solution would be appreciated. Thnx
UPDATE: Found the solution: changed the address by escaping some of the slashes. Instead of:
Unreplied Threads
EPDM foam for hard-shell case?
- Huckle
- 1 minute ago
- Social
- Replies: 0
Huckle Asks: EPDM foam for hard-shell case?
I need to fly with some delicate and slightly heavy equipment that is going to have to be checked in. I have hard-sided cases I can put it in that came with convoluted open cell foam. Given the weight, I’d like to put a sturdier foam in, as I’ve seen the equipment shift in the convoluted foam just from regular day-to-day travel. I assume the airline baggage handlers will drop-kick it.
Polyethylene foam seems like the popular option for custom cut case foam, but while looking at the selection at the local hardware store website I saw they also have closed cell EPDM (ethylene propylene diene monomer) foam, which is much cheaper.
Has anyone attempted to cut/glue EPDM before? Does it work well as a case foam?
HVAC motor wire help
- David
- 2 minutes ago
- Social
- Replies: 0
David Asks: HVAC motor wire help
I’m without heat and need some quick help. I had my hvac blower motor (16 years old) burn up from the intake being blocked. I got a replacement but it has a difference in wiring. The original has the 2 brown capacitor wires, the green ground, then harnesses a red, yellow, and black. The new one has the brown capacitor wires, green ground, and then a black and white. It also has a set of purple and yellows that dictate direction. How can I wire the new one into my system. Thank you in advance.
Covariate selection for double robust estimations
- Magdalena
- 2 minutes ago
- Education
- Replies: 0
Magdalena Asks: Covariate selection for double robust estimations
I would like to combine a matching technique and a regression analysis. I have a binary treatment and several covariates.
As I understand, I can either A) use the same covariates in the matching and the regression analysis or B) include only covariates describing the selection into treatment mechanism in the matching and add further covariates (describing the outcome mechanism) in the outcome model I estimate afterward.
Do I understand this correctly? If yes, how do I decide on one of the two options, and which papers discuss this issue?
Linear regression with ARIMA errors and seasonal dummy covariates: how does differencing works?
- adrimsvieira
- 2 minutes ago
- Education
- Replies: 0
adrimsvieira Asks: Linear regression with ARIMA errors and seasonal dummy covariates: how does differencing works?
To model my daily time-series data, I want to use linear regression with ARIMA errors. I also want to introduce several seasonal dummy covariates (day of the week, month of the year). I read in Hyndman & Athanasopoulos (2018) the following
Источник
windows — PHP and Imagick error: Uncaught ImagickException: UnableToOpenBlob ‘test.pdf’-
I am having a hard time using Imagick in PHP 7.3 to convert PDF to image. When I run the following code:
I get the following error:
I tried using an absolute path (C:xampphtdocsMy codescURLsphp-curl-classPDFstest.pdf) but I got the error below:
I followed this [guideline][1] to select the Imagick library and my settings are: -Windows 10 -XAMPP -PHP 7.3.27 (cli) (built: Feb 2 2021 20:46:26) ( ZTS MSVC15 (Visual C++ 2017) x64 ) -Thread Safety => enabled -Architecture => x64
Any solution would be appreciated. Thnx
UPDATE: Found the solution: changed the address by escaping some of the slashes. Instead of:
Additional Information:
Didn’t find the answer?
Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.
Similar questions
Find the answer in similar questions on our website.
Write quick answer
Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.
About the technologies asked in this question
PHP (from the English Hypertext Preprocessor — hypertext preprocessor) is a scripting programming language for developing web applications. Supported by most hosting providers, it is one of the most popular tools for creating dynamic websites. The PHP scripting language has gained wide popularity due to its processing speed, simplicity, cross-platform, functionality and distribution of source codes under its own license.
https://www.php.net/
programmierfrage.com is a question and answer site for professional web developers, programming enthusiasts and website builders. Site created and operated by the community. Together with you, we create a free library of detailed answers to any question on programming, web development, website creation and website administration.
Get answers to specific questions
Ask about the real problem you are facing. Describe in detail what you are doing and what you want to achieve.
Help Others Solve Their Issues
Our goal is to create a strong community in which everyone will support each other. If you find a question and know the answer to it, help others with your knowledge.
Источник
Fatal error uncaught imagickexception unabletoopenblob
I downloaded ImageMagick and GhostScript to run a php program that converts a pdf file into an image file such as jpg on a Windows 10 Pro PC as a home server with xampp.
The steps are as shown in GitHub repository I did it.
Error message
The output from phpinfo (); confirms that imagick is enabled.
Actually using imagick, even if you read pdf and jpg files using readImg and other functions, you can also use file_get_contents (‘image file path (full path and relative path tried)’) Reading the output just returns the following error, for example:
GitHub repositories also indicated «reflecting» Yes, I think it’s a problem with ImageMagick’s version.
If it is VC15, it seems that ImageMagick less than version 7 has not been released, and it cannot be downgraded.
Please lend someone wisdom. Thank you.
1. Below is a copy of README.md in the GitHub repository. 2.Usage environment, software
Windows 10 Pro
・ xampp (PHP 7.2.12) (Control Panel version is v3.2.2)
・ ImageMagick-7.0 .7-11-vc15-x86
・ php_imagick-3.4.3-7.2-ts-vc15-x86
・ Ghostscript 9.26 for Windows (32 bit) AGPL licence
・ Microsoft Word 2016
3.Experiment and results
Experiment date: 2018/11/25
3-1-1.Experiment 1 Terminal server development [1]
①Installed XAMPP according to the reference site [1].
However, all software was selected and installed.
The directory where xampp is installed is c: xampp .
② Accessed http: // localhost /.
3-1-2.Result of Experiment 1
A page similar to Figure 3-1-2 is displayed.
Figure 3-1-2
Figure 3-1-2 Results of Experiment 1
3-2-1 Experiment 2 Confirmation of expansion module
①Created the following file test.php [2] and copied it to C: xampp htdocs . Copying to this directory is equivalent to uploading to the server.
② A text hoge.pdf written only as «hoge.pdf» in Microsoft Word 2016 was created and copied to C: xampp htdocs .
(3) The test.php uploaded to the server was viewed with a WWW browser.
3-2-2.Experiment 2 results
As a result of Experiment 2, Fatal error was displayed as follows.
This indicates that the server created by xampp does not have a class called Imageck, that is, ImageMagick is not installed.
3-3-1.Experiment 3 Enable ImageMagick [2]
①Create the following isTs.php [3], copy it to c: xampp htdocs , access http : //localhost/isTs.php,
・ Confirmed php version.
-Confirmed the Compiler version.
• Confirmed Architecture.
-Checked whether thread safe is enabled.
② I installed GhostScript in C: xampp gs gs9.26 .
(3) Accessed the official download page of ImageMagick and downloaded ImageMagick-7.0.7-11-vc15-x86.zip.
This is because vc15 is the version of the php compiler included in xampp, and x86 is that all software included in xampp runs on 32 bits. (Please check Table 3-3-3-1)
Then expanded and copied the entire contents to c: xampp ImageMagick .
④ Go to the official download page of Imagick, select the 3.4.3 directory, and search for php_imagick-3.4.3-7.2-ts-vc15-x86.zip .
7.2 means php version is 7.2.n, ts means thread safe is enabled, vc15 means compiler version, x86 means 32 bit.
If i do not select the correct zip file corresponding to Table 3-3-1, you will not be able to experiment properly.
php_imagick-3.4.3-7.2-ts-vc15-x86.zip did not exist on the download page shown in the reference site [2]. However, it was on another page [4], so I downloaded it.
After extraction, copy php_imagick.dll to C: xampp php ext ,
All files starting with CORE_RL _ were copied over to C: xampp ImageMagick bin .
⑤ C: xampp php php.ini
, so I added extension = php_imagick.dll there.
⑥ Environment variables were specified as shown in Fig. 3-3-1.
Figure 3-3-1 Setting environment variables
3-3-2.Result of Experiment 3
As a result of (1), we found out that Table 3-3-3-1.
Table 3-3-2-1 Installed php specifications
PHP Version | 7.2.12 |
---|---|
Compiler | MSVC15 (Visual C ++ 2017) |
Architecture | x86 |
Thread Safety | enabled |
After to were accessed http: //localhost/isTs.php , it was not displayed in step ①. (Please look at the repository).
This means that the ImageMagick module has been successfully loaded.
And when http: //localhost/test.php is accessed,
is displayed, and the error content is different from that in Experiment 2.
This confirmed that the php program itself had to be rewritten, but that the module itself was working.
3-4 Experiment 4 Reading php file and its result
I moved ImageMagick with php and looked for code in the php program that could read pdf files.
However, no matter what function was used to read the pdf or jpg file, reading the output of file_get_contents () only returned an error.
4. Reflections
According to the reference site [5] [6], if you download ImageMagick, you need to compile it with an appropriate method to create a file called configure.exe, and it is not possible with ImageMagick7 installed this time, and it is done with version 6 It seems to have to be.
Next time I try again, I will install ImageMagick6.
However, this change will make the situation even worse and not recoverable. C: xampp ImageMagick on GitHub and make it public.
5. Reference site
[1] http://www.kent-web.com/www/chap1.html
[2] https://qiita.com/_xider/items/73c29d79eb4e252e64f7
[4] https://windows.php.net/downloads/pecl/snaps/imagick/3.4.3/
[5] https://oxynotes.com/?p=10474
[6] https://qiita.com/tsukachin999/items/f955b77095ec8502ab9b
I want to see if I can access the file from php,
A request was made to add/modify questions.
I want you to check two things.
One,
Whether the file can be opened from php.
For example, using PHP: fopen-Manual.
If a file name consisting of simple alphanumeric characters can be opened at this time,
It can be confirmed that it is not a problem related to access rights.
Another one,
The file name of the uploaded file
Output to a temporary text file,
Check what encoding it is.
File name encoding is SJIS
If php internal encoding is UTF-8,
Since filenames may not be handled properly,
As a precaution, try to manage using PHP: mb_convert_encoding-Manual.
Источник
php_imagick.dll is version 5.4.20.0, downloaded from http://pecl.php.net/package/imagick/3.1.2/windows, latest stable TS version for PHP 5.4 (I’m running Apache 2.2.26 on Windows, via php5_module).
Dependencies were downloaded from http://windows.php.net/downloads/pecl/d … c9-x86.zip
I don’t know if I can upgrade it to ImageMagick-6.8.9-1 because it looks they are compiled with VC10 and I’m afraid they can be not compatible.
I tried before to run ImageMagick-6.8.9-1 as «external», but there was no way to make Piwigo «see» it.
From php_info():
imagick module
enabled
imagick module version 3.1.2
imagick classes Imagick, ImagickDraw, ImagickPixel, ImagickPixelIterator
ImageMagick version ImageMagick 6.8.8-4 Q16 x86 2014-01-29 http://www.imagemagick.org
ImageMagick copyright Copyright (C) 1999-2014 ImageMagick Studio LLC
ImageMagick release date 2014-01-29
ImageMagick number of supported formats: 225
ImageMagick supported formats 3FR, A, AAI, AI, ART, ARW, AVI, AVS, B, BGR, BGRA, BIE, BMP, BMP2, BMP3, BRF, C, CAL, CALS, CANVAS, CAPTION, CIN, CIP, CLIP, CLIPBOARD, CMYK, CMYKA, CR2, CRW, CUR, CUT, DCM, DCR, DCX, DDS, DFONT, DJVU, DNG, DOT, DPS, DPX, DXT1, DXT5, EMF, EPDF, EPI, EPS, EPS2, EPS3, EPSF, EPSI, EPT, EPT2, EPT3, ERF, EXR, FAX, FITS, FPX, FRACTAL, FTS, G, G3, GIF, GIF87, GRADIENT, GRAY, GROUP4, GV, HALD, HDR, HISTOGRAM, HRZ, HTM, HTML, ICB, ICO, ICON, INFO, INLINE, IPL, ISOBRL, J2K, JBG, JBIG, JNG, JNX, JP2, JPC, JPEG, JPG, JPT, JSON, K, K25, KDC, LABEL, M, M2V, M4V, MAC, MAP, MASK, MAT, MATTE, MEF, MIFF, MNG, MONO, MOV, MP4, MPC, MPEG, MPG, MRW, MSL, MSVG, MTV, MVG, NEF, NRW, NULL, O, ORF, OTB, OTF, PAL, PALM, PAM, PANGO, PATTERN, PBM, PCD, PCDS, PCL, PCT, PCX, PDB, PDF, PDFA, PEF, PES, PFA, PFB, PFM, PGM, PICON, PICT, PIX, PJPEG, PLASMA, PNG, PNG00, PNG24, PNG32, PNG48, PNG64, PNG8, PNM, PPM, PREVIEW, PS, PS2, PS3, PSB, PSD, PTIF, PWP, R, RADIAL-GRADIENT, RAF, RAS, RGB, RGBA, RGBO, RGF, RLA, RLE, RW2, SCR, SCT, SFW, SGI, SHTML, SPARSE-COLOR, SR2, SRF, STEGANO, SUN, SVG, SVGZ, TEXT, TGA, THUMBNAIL, TIFF, TIFF64, TILE, TIM, TTC, TTF, TXT, UBRL, UIL, UYVY, VDA, VICAR, VID, VIFF, VST, WBMP, WEBP, WMF, WMV, WPG, X3F, XBM, XC, XCF, XPM, XPS, XV, Y, YCbCr, YCbCrA, YUV
Directive Local Value Master Value
imagick.locale_fix 0 0
imagick.progress_monitor 0 0
Also, I was running before Menalto Gallery 2 with ImageMagick and had no problem. Now I’m trying to switch to Piwigo but it looks ImageMagick support is somewhat not yet ready, especially in Windows.
I downloaded ImageMagick and GhostScript to run a php program that converts a pdf file into an image file such as jpg on a Windows 10 Pro PC as a home server with xampp.
The steps are as shown in GitHub repository I did it.
Error message
The output fromphpinfo ();
confirms that imagick is enabled.
Actually using imagick, even if you read pdf and jpg files using readImg and other functions, you can also use file_get_contents (‘image file path (full path and relative path tried)’) Reading the output just returns the following error, for example:
<br />
<b>Fatal error</b>: Uncaught ImagickException: Failed to read the file in C: xampp htdocs test3.php: 5
Stack trace:
# 0 C: xampp htdocs test3.php (5): Imagick->readimage ('http: // localhos ...')
# 1 {main}
thrown in<b>C: xampp htdocs test3.php</b>on line<b>5</b><br />
GitHub repositories also indicated «reflecting» Yes, I think it’s a problem with ImageMagick’s version.
If it is VC15, it seems that ImageMagick less than version 7 has not been released, and it cannot be downgraded.
Please lend someone wisdom. Thank you.
1. Below is a copy of README.md in the GitHub repository.
2.Usage environment, software
Windows 10 Pro
・ xampp (PHP 7.2.12) (Control Panel version is v3.2.2)
・ ImageMagick-7.0 .7-11-vc15-x86
・ php_imagick-3.4.3-7.2-ts-vc15-x86
・ Ghostscript 9.26 for Windows (32 bit) AGPL licence
・ Microsoft Word 2016
3.Experiment and results
Experiment date: 2018/11/25
3-1-1.Experiment 1 Terminal server development [1]
①Installed XAMPP according to the reference site [1].
However, all software was selected and installed.
The directory where xampp is installed isc: xampp
.
② Accessed http: // localhost /.
3-1-2.Result of Experiment 1
A page similar to Figure 3-1-2 is displayed.
Figure 3-1-2
Figure 3-1-2 Results of Experiment 1
3-2-1 Experiment 2 Confirmation of expansion module
①Created the following file test.php [2] and copied it toC: xampp htdocs
. Copying to this directory is equivalent to uploading to the server.
<? php
$im = new Imagick ();
// Load the PDF for which I want to generate an image
$im->readImage ('hoge.pdf');
// Get the number of pages
$totalPage = $im->getImageScene ();
for ($i = 0;$i<= $totalPage;$i ++) {
// PDF page
$im->setImageIndex ($i);
// Fit thumbnail size to 640px
$im->thumbnailImage (640, 640, true);
//sharp
$im->sharpenImage (0, 1);
// Generate
$im->writeImage ('out_'. $i. '.jpg');
}
$im->destroy ();
?>
② A text hoge.pdf written only as «hoge.pdf» in Microsoft Word 2016 was created and copied toC: xampp htdocs
.
(3) The test.php uploaded to the server was viewed with a WWW browser.
3-2-2.Experiment 2 results
As a result of Experiment 2, Fatal error was displayed as follows.
><br />
><b>Fatal error</b>: Uncaught Error: Class 'Imagick' not found in C: xampp htdocs test.php: 3
>Stack trace:
># 0 {main}
>thrown in<b>C: xampp htdocs test.php</b>on line<b>3</b><br />
This indicates that the server created by xampp does not have a class called Imageck, that is, ImageMagick is not installed.
3-3-1.Experiment 3 Enable ImageMagick [2]
①Create the following isTs.php [3], copy it toc: xampp htdocs
, access http : //localhost/isTs.php,
・ Confirmed php version.
-Confirmed the Compiler version.
• Confirmed Architecture.
-Checked whether thread safe is enabled.
<? php
print phpinfo ();?>
② I installed GhostScript inC: xampp gs gs9.26
.
(3) Accessed the official download page of ImageMagick and downloaded ImageMagick-7.0.7-11-vc15-x86.zip.
This is because vc15 is the version of the php compiler included in xampp, and x86 is that all software included in xampp runs on 32 bits. (Please check Table 3-3-3-1)
Then expanded and copied the entire contents toc: xampp ImageMagick
.
④ Go to the official download page of Imagick, select the3.4.3
directory, and search forphp_imagick-3.4.3-7.2-ts-vc15-x86.zip
.
7.2 means php version is 7.2.n, ts means thread safe is enabled, vc15 means compiler version, x86 means 32 bit.
If i do not select the correct zip file corresponding to Table 3-3-1, you will not be able to experiment properly.
php_imagick-3.4.3-7.2-ts-vc15-x86.zip
did not exist on the download page shown in the reference site [2]. However, it was on another page [4], so I downloaded it.
After extraction, copyphp_imagick.dll
toC: xampp php ext
,
All files starting withCORE_RL _
were copied over toC: xampp ImageMagick bin
.
⑤C: xampp php php.ini
;;;;;;;;;;;;;;;;;;;;;;
;Dynamic Extensions;
;;;;;;;;;;;;;;;;;;;;;;
There is a place whereextension =
is lined up at
, so I addedextension = php_imagick.dll
there.
⑥ Environment variables were specified as shown in Fig. 3-3-1.
Figure 3-3-1
Figure 3-3-1 Setting environment variables
3-3-2.Result of Experiment 3
As a result of (1), we found out that Table 3-3-3-1.
Table 3-3-2-1 Installed php specifications
PHP Version | 7.2.12 |
---|---|
Compiler | MSVC15 (Visual C ++ 2017) |
Architecture | x86 |
Thread Safety | enabled |
After<2>to<6>were accessedhttp: //localhost/isTs.php
, it was not displayed in step ①. (Please look at the repository).
This means that the ImageMagick module has been successfully loaded.
And whenhttp: //localhost/test.php
is accessed,
><br />
><b>Fatal error</b>: Uncaught ImagickException: UnableToOpenBlob 'hoge.pdf': No such file or directory @ error/blob.c/OpenBlob/3315>in C: xampp htdocs test.php: 5
>Stack trace:
># 0 C: xampp htdocs test.php (5): Imagick->readimage ('hoge.pdf')
># 1 {main}
>thrown in<b>C: xampp htdocs test.php</b>on line<b>5</b><br />
is displayed, and the error content is different from that in Experiment 2.
This confirmed that the php program itself had to be rewritten, but that the module itself was working.
3-4 Experiment 4 Reading php file and its result
I moved ImageMagick with php and looked for code in the php program that could read pdf files.
However, no matter what function was used to read the pdf or jpg file, reading the output of file_get_contents () only returned an error.
4. Reflections
According to the reference site [5] [6], if you download ImageMagick, you need to compile it with an appropriate method to create a file called configure.exe, and it is not possible with ImageMagick7 installed this time, and it is done with version 6 It seems to have to be.
Next time I try again, I will install ImageMagick6.
However, this change will make the situation even worse and not recoverable. C: xampp ImageMagick on GitHub and make it public.
5. Reference site
[1] http://www.kent-web.com/www/chap1.html
[2] https://qiita.com/_xider/items/73c29d79eb4e252e64f7
[4] https://windows.php.net/downloads/pecl/snaps/imagick/3.4.3/
[5] https://oxynotes.com/?p=10474
[6] https://qiita.com/tsukachin999/items/f955b77095ec8502ab9b