所以,我试图将pdf文件转换成jpeg文件,但是当我阅读PDF文件与readImage($ _ FILES [“fileinput”] [“tmp_name”])给出致命错误。我通过html获取该文件,您可以在下面看到。PHP - Imagick致命错误,没有解释
HTML FORM:
<form enctype="multipart/form-data" class="generalForm" action="../includes/connect.php" method="POST">
<label class="headLabel">DODAJ</label>
<br>
<br>
<input class="inputTextSub" id="naziv" name="naziv" type="text">
<br>
<br>
<input class="inputTextSub" id="opis" name="opis" type="text">
<br>
<br>
<input class="inputTextSub" id="datumz" name="datumz" type="date">
<br>
<br>
<input type="file" name="inputfile" id="file" class="inputfile" />
<br>
<br>
<br>
<input class="button" style="margin-top:2em;" name="save" type="submit" value=" shrani ">
</form>
然后在这里是在PHP代码,我当用户按下按钮时执行。
if(isset($_POST['save'])){
if(!$_POST['naziv']==""&&!$_POST['opis']==""&&!$_POST['datumz']==""
&&!$_POST['datumk']==""&&isset($_POST['pr'])
&&isset($_POST['format'])&&$_FILES['inputfile']['size']>0){
$naziv = $_POST['naziv'];
$opis = $_POST['opis'];
$datumz = $_POST['datumz'];
$datumk = $_POST['datumk'];
$pr = $_POST['pr'];
$format = $_POST['format'];
$modId = $_SESSION['mod_id'];
$file = file_get_contents($_FILES['inputfile']['tmp_name']);
$im = new Imagick();
/*THIS LINE*/ $im->readImage($_FILES['inputfile']['tmp_name'].'[0]');
$im->writeImage("lala.jpg");
和finnaly的魔鬼:
Fatal error: in C:\xampp\htdocs\mod\includes\connect.php on line 49
请帮帮忙,即时通讯这个死亡。
删除'。 '[0]'''从$的IM> readImage($ _FILES ['inputfile'] ['tmp_name']。'[0]');' –
我不明白你为什么要使用'$ _FILES ['inputfile'] ['tmp_name']。'[0]'' $ _FILES ['inputfile'] ['tmp_name'] [0]'? –
如果我这样做@ManpreetSingh说现在的错误是: 致命错误:未捕获ImagickException:UnableToOpenBlob'C':没有这样的文件或目录@错误/ blob.c/OpenBlob/2702在C:\ xampp \ htdocs \ mod \ includes \ connect.php:49 Stack trace:#0 C:\ xampp \ htdocs \ mod \ includes \ connect.php(49):Imagick-> readimage('C')#1 {main}抛出C: \ xampp \ htdocs \ mod \ includes \ connect.php第49行 –