Solved

How to install the WMF Component of ImageMagick

Posted on 2011-02-27
7
1,309 Views
Last Modified: 2012-05-11
I'm running a Debian 6.0 server on which I have successfully installed Apache, PHP, MySQL, and various PHP plugins, including ImageMagick.  I am trying to use ImageMagick to convert some WMF files to a useable format.  I installed the following components successfully and then rebooted the machine:
# apt-get install imagick-bin
# apt-get install php5-imagick
# apt-get install libwmf-bin

Open in new window

I have the following PHP code:
<?php
try{
	$filename = 'foo.wmf';
	$im = new Imagick();
	$h = fopen($filename, 'rb');
	$im->readImageFile($h);
	$im->setImageFormat('png');
	
	header("Content-Type: image/png");
	print $im->getImageBlob();
}catch(Exception $e){
	echo $e->getMessage();
}
?>

Open in new window

But when I run this code, I get the following message:
unable to open file `/tmp/magick-XXK6kbGr': @ error/constitute.c/ReadImage/572
ImageMagick works when I try to convert a JPEG file, but not this WMF file.

What is going wrong?
0
Comment
Question by:sffc
  • 4
  • 2
7 Comments
 
LVL 3

Expert Comment

by:eappiah
ID: 34995706
Hello

Did you enable the extension in php.ini?
If you do a <? phpinfo()  ?> can you find anything about ImageMagick?

0
 
LVL 6

Expert Comment

by:mohansahu
ID: 34995980
Hi,

need libwmf - library for converting WMF files

have a look in the below link ,it might be help you.

http://wvware.sourceforge.net/libwmf.html

MS
0
 
LVL 1

Author Comment

by:sffc
ID: 35000338
Thanks for your responses!  Here is what phpinfo() says about ImageMagick:

phpinfo() on ImageMagic extension
I'm using the "apt-get" utility in Debian to install everything.  I said in my initial post that I have already run "apt-get install libwmf-bin", which I believe is the command that installs libwmf.  If it means anything, there are four packages that start with "libwmf" available to apt-get install:
libwmf0.2-7  libwmf-bin   libwmf-dev   libwmf-doc
Would it be beneficial to additionally install one of those?

Any other suggestions?
0
Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

 
LVL 1

Author Comment

by:sffc
ID: 35013320
To follow up with my last post, I ran this command:
apt-get install libwmf*

Open in new window

I rebooted the computer, but I'm stillg etting the same error.

How do you use iMagik in the command line so that I can see whether it's PHP's problem or iMagik's problem?
0
 
LVL 1

Accepted Solution

by:
sffc earned 0 total points
ID: 35013888
Okay, I found a way to make it work.  I ran the command:
apt-get install imagemagick

Open in new window

It seems that I had never actually installed ImageMagick!  Wow…
0
 
LVL 6

Expert Comment

by:mohansahu
ID: 35014611
Try in command line..

display <imagename>, check its getting image or not
0
 
LVL 1

Author Closing Comment

by:sffc
ID: 35178874
The problem was resolved after I ran the command above.
0

Featured Post

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

Suggested Solutions

Join Greg Farro and Ethan Banks from Packet Pushers (http://packetpushers.net/podcast/podcasts/pq-show-93-smart-network-monitoring-paessler-sponsored/) and Greg Ross from Paessler (https://www.paessler.com/prtg) for a discussion about smart network …
Since pre-biblical times, humans have sought ways to keep secrets, and share the secrets selectively.  This article explores the ways PHP can be used to hide and encrypt information.
Learn how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…
The viewer will learn how to dynamically set the form action using jQuery.

758 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now