Open Sencillo  2014.008
 All Data Structures Files Functions Variables Pages
imagick.convert.pdf2jpg.php
Go to the documentation of this file.
1 <?php
12 class PDFtoJPG
13 {
14  private $error=array();
15  private $j;
16 
23  public function convert($name,$id=0)
24  {
25  $imagick = new Imagick();
26  chmod("./cms_pdf_source/",0777);
27  chmod("./cms_images/",0777);
28  rmdir("./cms_images/user$id");
29  mkdir("./cms_images/user$id",0777);
30  mkdir("./cms_images/user$id/$name",0777);
31  chmod("./cms_images/user$id/",0777);
32  chmod("./cms_images/user$id/$name/",0777);
33 
34  $i=0;
35  $this->j=1;
36  while($i<100)
37  {
38  try
39  {
40  $imagick->readImage("./cms_pdf_source/user".$id."/".$name."[".$i."]");
41  $imagick->writeImage("./cms_images/user".$id."/".$name."/".$name."[".$i."].jpg");
42  //$imagick->writeImage("./cms_images/user".$id."/".$name."/".$name."[".$i."].jpg");
43  $this->j++;
44  }
45  catch(Exception $e)
46  {
47  $this->error[$i] = $e;
48  }
49  $i++;
50  }
51  return $this->j;
52  }
53 
58  public function errorList()
59  {
60  return $this->error;
61  }
62 }
63 ?>
convert($name, $id=0)