title: Php pdf image preview code
body: <p>I try to generate php code in order to preview an image from a pdf file. Here is my code. There is an error but i cannot understand where it is. I would appreciate any help. Thank you.</p>
  
  <pre><code> &lt;?php 
  //Get Menu Bar
  include('navigate.php'); 
  ?&gt;
  
  &lt;table cellspacing="4" width=100%&gt;&lt;tr&gt;&lt;?php if(!$vol){ ?&gt;&lt;td bgcolor="eeeeee" width="50%" valign="top"&gt;
  &lt;h3 style=" text-shadow:#003"&gt;Latest News:&lt;/h3&gt;
  
  &lt;?php 
  $latest=mysql_query("select * from articles ORDER BY id DESC LIMIT 1", $link);
  while ($article = mysql_fetch_array($latest)) {
  $thevolume= $article['volume'];
  $title=     $article['title'];
  $author=    $article['author_main'];
  $abstract=  $article['abstract'];
  $pdf=       $article['pdf'];
  $im =       new imagick('pdf');
  $im-&gt;setImageFormat('jpg');
  
  ?&gt;
  &lt;a href="&lt;?php echo $pdf; ?&gt; "PDF:  ?php echo "$title - $author"; ?&gt;
  &lt;img src="&lt;?php echo $im; ?&gt; " WIDTH="98%" border="1" title="&lt;?php echo "$title - $author"; ?&gt;  " caption="Click here to open PDF"  /&gt; 
  &lt;/a&gt;
  </code></pre>