make thumbnail for pdf file

Discussion in 'PHP' started by hba, Feb 28, 2008.

  1. #1
    hi
    how can create thumbnail image file for PDF file by php
    thanx :)
     
    hba, Feb 28, 2008 IP
  2. jnestor

    jnestor Peon

    Messages:
    133
    Likes Received:
    7
    Best Answers:
    0
    Trophy Points:
    0
    #2
    You can't.

    Well I guess anything is possible but you'd need to render the PDF which is no small task.
     
    jnestor, Feb 28, 2008 IP
  3. hba

    hba Peon

    Messages:
    7
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    i can
    with imagick (php_imagick.dll) can convert pdf to jpeg
    but i use xampp it make error
    
    <?php
     
    $im = new imagick('database.pdf[0]');
    $im->setImageFormat( "jpg" );
    header( "Content-Type: image/jpeg" );
    echo $im;
    ?>
    
    PHP:
    error:
    Fatal error: Uncaught exception 'ImagickException' with message 'Unable to read image' in D:\xamp\xampp\htdocs\thmubnail\pdf.php:3 Stack trace: #0 D:\xamp\xampp\htdocs\thmubnail\pdf.php(3): Imagick->__construct('database.pdf[0]') #1 {main} thrown in D:\xamp\xampp\htdocs\thmubnail\pdf.php on line 3

    how can fix it ??
     
    hba, Feb 28, 2008 IP
  4. hba

    hba Peon

    Messages:
    7
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    help please
    why imagick cant convert pdf?
     
    hba, Feb 29, 2008 IP
  5. hba

    hba Peon

    Messages:
    7
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #5
    i correct it with install
    GhostScript
    and
    imagick
    on server
     
    hba, Feb 29, 2008 IP
  6. ruby90

    ruby90 Peon

    Messages:
    721
    Likes Received:
    7
    Best Answers:
    0
    Trophy Points:
    0
    #6
    Ok it's fine :)
     
    ruby90, Feb 29, 2008 IP
  7. marijan_zg

    marijan_zg Peon

    Messages:
    2
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #7
    Dear,

    I put you code in test.php file and put database.pdf u that folder.
    I also uncomment php_imagic.dll in php.ini and restart the server.
    Also GD2 in uncommented.

    [php.ini]
    ---
    ;extension=php_fribidi.dll
    extension=php_gd2.dll
    extension=php_gettext.dll
    ---
    ;extension=php_iisfunc.dll
    extension=php_imagick.dll
    extension=php_imap.dll
    ---


    when I egzecute you code I get message :
    Fatal error: Class 'imagick' not found in C:\xampp\htdocs\test\test.php on line 2


    What is wrong? what can I check??
     
    marijan_zg, Aug 5, 2009 IP
  8. marijan_zg

    marijan_zg Peon

    Messages:
    2
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #8
    I tried to install ghostScript but I have the same ressult....
     
    marijan_zg, Aug 5, 2009 IP