0

why the last echo (<input value='Save Selections' type='submit'></form></body></html>") display nothing?

<?php
$pdf='aaa.pdf';
$image = new Imagick();
$image->pingImage($pdf);
$x = $image->getNumberImages();
echo "
<html><head>
<meta http-equiv='content-type' content='text/html; charset=UTF-8'>
<script type='text/javascript' src='//code.jquery.com/jquery-2.2.3.js'></script>

<style type='text/css'>
.bn {
    -webkit-filter: grayscale(100%);
    -moz-filter: grayscale(100%);
    -ms-filter: grayscale(100%);
    -o-filter: grayscale(100%);
    filter: grayscale(100%);
}
body {
    background: #000; 
}
img {
    padding: 5px;
    vertical-align: top;
}
label, input {
  vertical-align: top;
}
/* Uncomment this and the checkbox will be hidden,
   but it still exists and is sent when the form
   is submitted. */
/*
input[type=checkbox] {
    visibility: hidden;
}
*/
</style>

<title>pdf</title>
<script type='text/javascript'>
window.onload=function(){
$('input.imagepicker').change(function(e) {
    var imgLabel = $('label[for='+this.id+']');
    imgLabel.find('img').toggleClass('colore bn');
});}
</script>
</head>
<body>
  <form id='savepics' action='#' method='post'>
<!-- by making the image the label for the checkbox,
     clicking the image also toggles the checkbox state. -->";

for ($i=0; $i <= $x; ++$i){
 $im = new Imagick();
 $im->setResolution(20, 20);
 $im->readImage(''.$pdf.'['.$i.']');
 $im->setImageFormat('jpeg');
 $im->setImageCompression(imagick::COMPRESSION_JPEG); 
 $im->setImageCompressionQuality(100);
 $jpegpath = 'jpeg/'.$pdf.'['.$i.'].jpeg';
 $im->writeImage($jpegpath);
 echo "

<label for='page$i'><img id='pageimage$i'
  class='colore selectable'
  src='$jpegpath'
  alt='pag$i'/></label>
<input type='checkbox' name='page$i' id='page$i' class='imagepicker'></input>
";
}
   
echo "<input value='Save Selections' type='submit'></form></body></html>";
?>
  • 1
    you forgot ; at the end of the line – KubiRoazhon Apr 18 '16 at 14:50
  • excuse me .. i edit the question..in my script is there but does not work the same ..the problem isn't the ; – Alessandro Clarea Apr 18 '16 at 14:54
  • Is everything in the for loop running correctly and echoing labels/inputs ok? If so, you should turn on php errors http://stackoverflow.com/questions/1053424/how-do-i-get-php-errors-to-display – Matthew Lymer Apr 18 '16 at 14:58
  • yes.. the error: Uncaught exception 'ImagickException' with message 'Postscript delegate failed `aaa.pdf': No such file or directory @ error/pdf.c/ReadPDFImage/677' in /var/www/html/phpp/new_ok2.php:58 Stack trace: #0 /var/www/html/phpp/new_ok2.php(58): Imagick->readimage('aaa.pdf[13]') #1 {main} thrown in – Alessandro Clarea Apr 18 '16 at 15:10
  • it seems that the final PDF page gives error .. – Alessandro Clarea Apr 18 '16 at 15:13

0 Answers0