0

I've got this page called pdf.php:

<?php

$im = new imagick( 'uploadedfiles/logo.pdf[0]' );

$im->setImageFormat( "png" );

header( "Content-Type: image/png" );
echo $im;

?>

Then I've got script that echos this:

$pdf_ext = '<div class="aList" style="cursor:pointer; width:100%; clear:both; overflow:hidden; height:auto; margin-bottom:5px;" id="pdf.php"><div style="float:left; margin:0 5px 0 0; padding:0 5px; width:auto;height:20px;border:2px solid black;">' . $ext . '</div>' . $a_name . '</div>';

This is what's displayed when I click on div.aList:

<div id="aPreview"><img /></div>

And in background jquery script after clicking on div.aList does this:

// Element ID is send via $(".aList").live("click") event
function showPreview(elementId) {

    $("#aPreview img").attr('src',elementId);
    $("#aPreview").fadeIn('slow');

    $("body").click(function() {

        $("#aPreview").fadeOut('slow');

    });

}

But it doesn't show the image, what might be wrong?

emil.c
  • 1,987
  • 2
  • 26
  • 46
  • 2
    This calls for basic debugging. What does the PHP script actually output? Does it contain a valid image URL? If it does, does your jQuery code actually find the correct element? Are you getting any errors on the Javascript console? Etc. etc. – Pekka Feb 19 '12 at 19:10
  • I guess it's always hidden in simple things, I haven't checked what pdf.php returns and it returns: `Fatal error: Class 'imagick' not found in /Users/emilcieslar/Sites/mozkozdroj/thumb/pdf.php on line 4` so I guess I don't have imagick library installed. – emil.c Feb 19 '12 at 19:51
  • yup, that probably is the reason then. See here for install info: http://www.php.net/manual/en/imagick.installation.php – Pekka Feb 19 '12 at 19:53
  • Well I'm not able to install it, I cannot find out how to install this library on mac. – emil.c Feb 19 '12 at 21:02
  • I'm not familiar with that either. Maybe this helps: [Install PECL on Mac OS X 10.6](http://stackoverflow.com/q/5536195) – Pekka Feb 19 '12 at 21:03

1 Answers1

0

Just needed to install imagick library to my mac.

emil.c
  • 1,987
  • 2
  • 26
  • 46