图片扩展库(Imagick)小问题
环境如下:
Apache/2.4.18 (Win64) OpenSSL/1.0.2e PHP/5.6.16
imagick module version 3.4.2
imagick classes Imagick, ImagickDraw, ImagickPixel, ImagickPixelIterator, ImagickKernel
Imagick compiled with ImageMagick version ImageMagick 6.9.3-7 Q16 x64 2016-03-27 http://www.imagemagick.org
Imagick using ImageMagick library version ImageMagick 6.9.3-7 Q16 x64 2016-03-27 http://www.imagemagick.org
Demo1 代码如下:
ini_set('display_errors',1);
header('Content-type: image/jpeg');
$image = new Imagick('1.jpg');
$image->thumbnailImage(100,0);
echo $image;
exit;
报如下错误:
图像“http://www.testf.com/test.php”因存在错误而无法显示。
Demo2 代码如下
$thumb = new Imagick();
$thumb->readImage('1.jpg');
$thumb->writeImage('test.gif');
$thumb->clear();
$thumb->destroy();
exit;
报如下错误:
Fatal error: Uncaught exception 'ImagickException' with message 'UnableToOpenBlob `1.jpg': No such file or directory @ error/blob.c/OpenBlob/2702' in I:\wamp\Apache24\htdocs\test\test.php:3 Stack trace: #0 I:\wamp\Apache24\htdocs\test\test.php(3): Imagick->readimage('1.jpg') #1 {main} thrown in I:\wamp\Apache24\htdocs\test\test.php on line 3
请指点一下,谢谢。
回复讨论(解决方案)
检查你的 1.jpg 是否存在,路径是否正确
图片,路径正确
别逗了, ..... `1.jpg': No such file or directory 没有这样的文件或目录
别逗了, ..... `1.jpg': No such file or directory 没有这样的文件或目录
那你觉得这样如何呢。
<?php$imagick = new Imagick();$imagick->readImage('http://images.csdn.net/20160518/380-253.jpg');$imagick->writeImages('converted.jpg', false); exit;
错误提示:
Fatal error: Uncaught exception 'ImagickException' with message 'Failed to read the file' in I:\wamp\Apache24\htdocs\test\test.php:3 Stack trace: #0 I:\wamp\Apache24\htdocs\test\test.php(3): Imagick->readimage('http://images.c...') #1 {main} thrown in I:\wamp\Apache24\htdocs\test\test.php on line 3
Failed to read the file 读取文件失败
怎么是我觉得如何呢?
他已经清清楚楚的告诉了你问题的原因!
好吧。算我没问。

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

Laravel simplifies handling temporary session data using its intuitive flash methods. This is perfect for displaying brief messages, alerts, or notifications within your application. Data persists only for the subsequent request by default: $request-

The PHP Client URL (cURL) extension is a powerful tool for developers, enabling seamless interaction with remote servers and REST APIs. By leveraging libcurl, a well-respected multi-protocol file transfer library, PHP cURL facilitates efficient execution of various network protocols, including HTTP, HTTPS, and FTP. This extension offers granular control over HTTP requests, supports multiple concurrent operations, and provides built-in security features.

Laravel provides concise HTTP response simulation syntax, simplifying HTTP interaction testing. This approach significantly reduces code redundancy while making your test simulation more intuitive. The basic implementation provides a variety of response type shortcuts: use Illuminate\Support\Facades\Http; Http::fake([ 'google.com' => 'Hello World', 'github.com' => ['foo' => 'bar'], 'forge.laravel.com' =>

Do you want to provide real-time, instant solutions to your customers' most pressing problems? Live chat lets you have real-time conversations with customers and resolve their problems instantly. It allows you to provide faster service to your custom

Article discusses late static binding (LSB) in PHP, introduced in PHP 5.3, allowing runtime resolution of static method calls for more flexible inheritance.Main issue: LSB vs. traditional polymorphism; LSB's practical applications and potential perfo

PHP logging is essential for monitoring and debugging web applications, as well as capturing critical events, errors, and runtime behavior. It provides valuable insights into system performance, helps identify issues, and supports faster troubleshoot

The Storage::download method of the Laravel framework provides a concise API for safely handling file downloads while managing abstractions of file storage. Here is an example of using Storage::download() in the example controller:

Laravel's service container and service providers are fundamental to its architecture. This article explores service containers, details service provider creation, registration, and demonstrates practical usage with examples. We'll begin with an ove
