How To Find And Test Imagemagick Using Php

free web hosting
Free Web Hosting > Computers & Tech > How-To's and Tutorials > Programming > PHP

How To Find And Test Imagemagick Using Php

docduke
One of the powerful graphics manipulation programs that AstaHost provides is ImageMagick. AstaHost recognizes its importance by placing a reference to it on its home page in the right column:

Our Free Web Hosting offer :-
  • ...
  • * ImageMagick Support
I have not seen ImageMagick mentioned in any other free, or nearly free, Web service. This is one of the things that attracted me to AstaHost. ImageMagick is very powerful. As its website describes its capabilities:
  • ImageMagick® is a software suite to create, edit, and compose bitmap images.
  • It can read, convert and write images in a variety of formats (over 100).
  • ImageMagick is free software delivered as a ready-to-run binary distribution or as source code that you may freely use, copy, modify, and distribute. Its license is compatible with the GPL. It runs on all major operating systems.
Personally, I am interested in it because it is a necessary tool in MediaWiki. If one wishes to typeset mathematical equations in MediaWiki (as is done in Wikipedia), ImageMagick is a required component of the extension that provides this capability.

A while ago, I had trouble finding it on gamma.xisto.com. This tutorial shows how to test for it, and verify that it is functional. Since the primary focus of AstaHost is web hosting, the tutorial is in PHP. This illustrates how ImageMagick can be used in any website that uses PHP scripts.

Here is a PHP program to test for the presence of ImageMagick, and print out its version number.
CODE
<html> <head> <title>Test for ImageMagick</title> </head>
<body> <?
function alist ($array) {  //This function prints a text array as an html list.
  $alist = "<ul>";
  for ($i = 0; $i < sizeof($array); $i++) {
    $alist .= "<li>$array[$i]";
  }
  $alist .= "</ul>";
  return $alist;
}
exec("convert -version", $out, $rcode); //Try to get ImageMagick "convert" program version number.
echo "Version return code is $rcode <br>"; //Print the return code: 0 if OK, nonzero if error.
echo alist($out); //Print the output of "convert -version"
//Additional code discussed below goes here.
?> </body> </html>

Create a file in your public_html folder or a subfolder, paste this text into it, and name it something like test4im.php where the ".php" ending is necessary to get the PHP interpreter to process it. Point a browser at this file (e.g. http://[your website]/test4im.php). If you have access to "convert," you will get a return code of 0 plus two or three lines of text, reporting the version and location of ImageMagick. Strictly speaking, you do not need to create the alist function since it is only called once here, but if you wish to test other things, it will save repetitive typing. (This is, after all, a tutorial on PHP.)

There is one more important step to make sure you can use ImageMagick. Almost everything you do with it will involve creating a file. Therefore, you need to be sure you can give it an argument that correctly identifies the location you want, and provides the appropriate permissions. Suppose you want the output in a folder called "temp" in your public_html folder. First you must create the folder and set its permissions. Use cPanel to create a folder "public_html/temp". Use the "permissions" tool to set "temp" to "777" which means anyone (including the "user" that runs an html task) can write to the "temp" folder. Now add the following two lines to your "test4im.php" program, at the location of the next-to-last line above.
CODE
exec("convert logo: /home/[your cPanel name]/public_html/temp/imlogo.gif", $out, $rcode);
echo "Logo return code is $rcode <br>";

The first line creates an ImageMagick logo image and stores it in the "temp" folder. The second prints the return code. Save this modified file and reload the browser page. If you got a version number before, and now get a non-zero return code, you probably didn't create the "temp" folder in the right place, or set its permissions correctly. If you get a return code of 0, examine the "imlogo.gif" file using the "View" tool in the cPanel File Manager. You should see this:
The default logo image is 640x480 pixels. If you want a smaller one, such as the one above, creating it is as simple as:
CODE
convert logo: -resize 25% /home/[your cPanel name]/www/temp/imlogo2.gif

Once you have it running, the Basic Usage page will give you lots of ideas on how to use ImageMagick for your own applications. When you are ready to study the details, the options page will show you how to do much more complex image transformations.

Enjoy! cool.gif

 

 

 


Reply

TavoxPeru
Thanks a lot docduke, i just follow your tutorial and test your code and every thing works perfectly.

BTW, this is the first time that i use Imagemagick and to be honest it is awesome, i don't know that with it you can do a lot of incredible things with images.

Best regards,

Reply

yordan
ImageMagick is used by 4gallery photogallery. When you set up your site, it asks you where imagemagick is installed in your server. If not, you have to use gl libraries, which generally use too much memory.

Reply


Got an Opinion! Express your Views! (no registration):-
Add your Reply/ Opinion/ Views/ Comments/ Suggestion/ Questions/ Queries etc.
Posts with decent grammar & English will be accepted and please refrain from profanities.
For asking a Question, We recommend you to sign-up (for free) so that you can track the topic easily.

Nature of your Post*: Opinion/ Reply/ Comments
Question/Query
Feedback to us.
       
Name   Email
Title/Question*

(Maximum characters: 10,000)
You have characters left.
Confirm Code:

Recent Queries:-
  1. imagemagick exec - 2.67 hr back. (2)
  2. imagemagick installed test - 3.18 hr back. (1)
  3. imagemagick php exec - 3.50 hr back. (1)
  4. test imagemagick with php - 4.00 hr back. (1)
  5. imagemagick exec() - 4.59 hr back. (1)
Similar Topics

Keywords : test, imagemagick, php

  1. Bomb Test(amazing)
    sorry if repost (4)
  2. Test Drive
    xbox 360 game (1)
    this is one of my favorite games on the 360. you start with a house that you can afford and you
    choose a car that you can afford. each car that you buy's allows you to enter different races.
    Their are also single (like time-trial) races. in order to beat the game you must have all houses
    and all cars and you must have placed 1st in every single race!!! in my opinion this
    game is very challenging and will keep you entertained for hours.....
  3. The Legacy Of Holy Castle Closed Beta Test Is Now Live!
    Free Strategy Game (1)
    Finally the moment comes! Close Beta Testing of The Legacy of Holy Castle official launched
    today. A totally new gaming world will be brought to you by PKVE, a group with rich-experienced game
    masters and professional operators. We are sure you will have a good time in gaming process. Join us
    with your friends! The legacy of Holy Castle world is waiting for you to rewrite the
    HISTORY! To create an account, please sign up here! (http://holy.pkve.com/) About The
    Legacy of Holy Castle The Legacy of Holy Castle is an Middle Age Online Strategy Browser-bas....
  4. Free Online Speed Test
    Post your results here (12)
    Online bandwidth speed test , helps you to know whether you are getting the bandwidth speed that
    you deserve . Run our free Internet Speed test tool and see just how your internet connection
    measures up. Click here to test Then post your results in the following format : Your Service
    provider : Location : Plan Details : Up speed : Down speed : Promised : Received : Satisfied
    :....
  5. Test Out Cms And Other Php Stuff
    Open-Source CMS (0)
    If you are looking for a content management system but don't know which one to pick, here is a
    site where you can test all of them, in Administrator mode to see which one suits you best.
    http://opensourcecms.com/ This site allows you to do whatever you want with a CMS system for
    testing purposes. It gives you administrative access to the control panel so you can create/delete
    content without messing up something and to see if it is easy enough for you to use. The systems are
    wiped out after a predetermined time of 2 hours, so that everything is refreshed again. ....
  6. Tremulous Is A Free And Open Source Team-based First-person Shooter With Real-time Strategy Elements
    Test it ! (0)
    Tremulous is a free and open source team-based first-person shooter with real-time strategy
    elements. It was released on March 31, 2006 . Game-play is similar to the Quake II mod Gloom. The
    game features two teams, humans and aliens, each with their own strengths and weaknesses. The game
    has been downloaded over 800,000 times and was voted "Player's Choice Standalone Game of the
    Year" in Mod Database's "Mod of the Year" 2006 competition. Though Tremulous features a similar
    theme and game-play to Natural Selection, it is not based on it, nor inspired by it. Develo....
  7. Test
    (2)
    <script>alert("test") ....
  8. How To Make An Test-based Rpg Game!
    This is a step by step tutorial of how to make a RPG test-based game (4)
    Welcome Hello this is Convictlife and i have made an RPG game and for you noobs out
    there i will be explaining Here is a breif structure of this post: 1. Getting your codes. 2.
    Getting your host. 3. Uploading your codes. 4. Configuring your codes. 5. MySQL 6. phpMyAdmin 7.
    CronJobs 8. Editing 9. Finalizing Getting Your Codes! First of all you need codes that
    will power your website. If you are a master coder (like Dabomstew) then you can code these codes
    yourself, but if you are "so-so" then you will need to get codes from somewhere. I got....
  9. Is Gre Test Necessary In Canada ?
    a guy from Pakistan needs to be informed (1)
    informatic Seed Taste/benifit Test Test I m abbas from Pakistan and I want to go in canada for
    becholar in enjineering.For this perpose is there any need of GRE test or not.Also is it beneficail
    for me or not.If it is so then Please inform me how can I do? Now what should I do? how much time
    it will take? What is the requirements for GRE test? I m waiting your response. -Ghulam Abbas I
    move your topic here, where is most probably his place ....
  10. Online Pc Test
    (0)
    Using Internet Explorer, go to THIS LINK and choose to scan your system. Link here: CODE
    http://gameadvisor.futuremark.com/gameadvisor/service/ 1) It should tell you how many
    people (in percentages) have better computers than yours, letting you know where your pc stands
    today. 2) There is also a performance meter on the side which will tell you how good your PC will
    be able to run games (Average ones). 3) It should also tell you your PC specs on the top part of
    the page.....
  11. Ie8 Passes Acid 2 Test
    (16)
    Another step in working towards interoperability. It is very important in the world where web
    browsers are free and there are many alternatives. For example: Mozilla Firefox and Opera. On
    December 19, Ars Technica ran an article that confirms the pre-beta builds of Internet Explorer 8
    did indeed pass the Acid 2 test. According to the same article, Microsoft is walking on a thin line
    between interoperability and compatibility with older Internet Explorer builds like 6 and 7. Also,
    it should be noted that the first Internet Explorer 8 beta will be released in early 2008. ....
  12. Ubuntu 7.04 - Test Drive
    (0)
    So I randomly got the urge yesterday to wipe my linux partition clean and install a new distro, or
    at least a new release, and get back into linux a bit. I always have a linux partition on my system
    but I usually go through phases where I use it more or less. Regardless I have used multiple distros
    (a bit of gentoo and slack, redhat, suse, madrake, mandiva, fedora, mepis, ubuntu, etc) and had used
    ubuntu 6.06 for awhile. I had actually installed 6.10 around the end of last year but over time I
    broke some things playing with compiz and eventually just sort of stopped usin....
  13. Internet Speed Test
    Internet Speed Test, Post your results here ! (13)
    Hai , I have introduced a Bandwidth Speed Test Service in my website located @ http://www.jbi.in
    I request you to post your speed test results here : First let me start : Service Provider
    Details : Service Provider : Bharat Sanchar Nigam Limited . Pvt / Govt. : Government Service.
    Location : India. Promised Speed : Upto 2 mbps Rental : Rs 250 per month ( nearly $6 per month
    ) Speed Test Results : My Ip : 59.92.113.38 ( Note your ip will be displayed when speed test
    result is shown ) My Speed : 784.90kbps Download Speed : 98.11 KB/sec Postion : DSL. ....
  14. Test What Html Code Looks Like Inside Of A Code Box
    (0)
    Fun Pics Picture 1 Picture 2 Picture 3 Picture 4 Picture 5 Picture 6 Picture 7
    ....
  15. Free Gre Test Prep!
    (0)
    For those of you who are in college or want to get into graduate school, you need to take the GRE.
    Well, here's some free stuff, including a powerprep program that'll help you prepare for
    your exam. http://www.ets.org/portal/site/ets/menuite...00022f95190RCRD If anyone finds any
    more useful GRE stuff, please let me know. I'm planning on taking it later this year.
    Thanks! - Trinifawk....
  16. Test Drive Unlimited - Pc
    The latest Test Drive - ATARI game (4)
    Hi folks, I just bought the new Test Drive game - Test Drive Unlimited - and personal I'm a
    simulation fan, and as far I've played the Test Drive-serie they were really arcade. But this
    one is a real nice combination of arcade and simulation. Beside that you have a gigantic eiland to
    cruise with your exotic cars. So my conclusion, for all race-game lovers the is a MUST buy !
    Awsome work of ATARI. Greetz. Some screenshots*: *screenshots are property of
    "gamers.net" ....
  17. Multiple Versions Of Ie
    want to test your pages? (7)
    When IE7 was installed on my Windows installation, I always wanted to test my pages on IE6,
    didn't know how to do it, but recently I found this tool, called Multiple_IE, it is a "program"
    which has a simple installer and you can install different Internet Explorer versions on one
    system.. before I didn't know about this, I was reading about using virtual machine stuff.. The
    "program" installs the required files on your computer, it is best to use it if you have IE7
    installed! with it you can test your pages in IE7,IE6,IE5,IE4 and even IE3 which as I know does....
  18. Windows Vista
    Details and Opinion Of Vista - Beta Test (1)
    A month a go, i downloaded the Beta of Vista and spotted 37 bugs and reported them all. Vista
    Review: Vista is a great new package for an OS. It has so many new features, some i didn't
    expect. It has changed dramatically also. the 3D look, it looks good to your home PC, but at work i
    can see it getting annoying. The 3D screens of IE, are so annoying i looked straight away for a way
    to turn it off. The Control Panel, it's much easier to use and looks stylish, easy for a newbie
    if they're new to PCs or Windows. There are many more features im yet to look prop....
  19. Ketnsfiel Vs Conroe
    test (1)
    Competition between “brothers” For a long a amount of time during which their
    solutions have proven to be more and more inefficient, those at intel have realized there is a need
    for a change and have replaced the Pentium generation with the Core generation. The beginning of
    this new stage in the evolution of the biggest chipset producer have been characterized by the Core
    2 Duo E6300, E6400, E6600, E6700 and the top model Core 2 Extreme X6800. the list of processors from
    the new generation is being completed now by that introduction of Core 2 extreme qx670....
  20. IPmobile To Test 42mbps Cellular Data
    (1)
    QUOTE A Japanese mobile carrier will test a cellular technology that promises downloads as fast
    as 42.2Mbps (bits per second) in Tokyo this month. The tests will be conducted by IPMobile, a new
    cellular carrier that is planning to launch a data-centric commercial service in the Tokyo area next
    year based on the TD-CDMA (time division code division multiple access). The service had been due to
    launch in October 2006 in three cities, but has been scaled back to just Tokyo and will launch about
    six months later than planned. IPMobile's initial commercial service ....
  21. Firefox 3.0 Passes The Acid Test (finally)
    (8)
    With the much awaited official release of Firefox 3.0 Alpha our favourite browser has finally
    managed to pass the Acid Test . Codenamed Grand Paradiso, starting from this version Firefox
    implements the Gecko 1.9 rendering engine and boasts heavily refactored reflow algorithms that
    improve Firefox layout functionality and resolve some long-standing CSS bugs. Ryan Paul at
    arstechnica has provided us with an great insight into these improvements... QUOTE The reflow
    improvements in Gecko 1.9 (included in the latest Gran Paradiso nightly build, but not....
  22. Need An Autoresponder? Free For Life If You Can Test It Out
    Beta Testers wanted (10)
    We are in the process of setting up an autoresponder (like aweber etc) and are pretty much ready to
    test. The service will have a free "lite" version, and then the regular service for a monthly free.
    If you are interested in helping us test the functionality of everything I would be pleased to give
    you the paid service free, which is regularly $20/month. If you want to give it a whirl,
    please PM me. Thanks.....
  23. Should This Great Site Offer Imagemagick ?
    May be the admin of this site think over it. (3)
    Hi As we all know that this website is very good and offering good services. I just wanna know if
    other people also want ImageMagick to be installed on this server with free accounts... so please
    let me know and lets check if the Admin of this site can isntall it..... Fun....
  24. Php Script/tutorial Test Site Another Xisto Service Possibility
    (10)
    http://www.trap17.com/forums/php-script-tu...ity-t41333.html Last couple of weeks I been having
    this idea for another volunteer xisto service. We take php scripts from across the net, from
    tutorial sites, download sites and what not and test them out to see if they actually work. Then
    give them a rating of 1-5 1 being the script don't work and 5 being the script works like it
    supposed to. If they do work we provide a live demo to it. Now The set up would go like this if
    the script runs into problems we would post the problem through a news/comment system (like ....
  25. Online Personality Disorder Test!
    Its fun .. Do you think it's any good ? (38)
    Online tests ! While usually crap (or nonsense like "Which *insertseries* character are you?") I
    don't disgregard one too soon. Of responses I've read and own 'result' I kinda like
    this one; http://www.4degreez.com/misc/personality_disorder_test.mv Be honest ! I had
    QUOTE Disorder | Rating Paranoid: Moderate Schizoid: High Schizotypal: Low Antisocial: Low
    Borderline: Low Histrionic: Low Narcissistic: Low Avoidant: Low Dependent: Low Obsessive-Compulsive:
    Low "People with schizoid personality disorder avoid relationships and do not s....
  26. How To Test Drupal Themes?
    (14)
    I am writing a Drupal theme and I would like to test it out before using it on my website. Is
    there a way to test it? ....
  27. Test Your Fps Skills
    (0)
    I've always loved a good LAN to test my FPS skills against a bunch of other people who also have
    it in their mind that they are the best. Any of you interested in such LAN tournaments, will
    appreciate a look at the upcoming LANsomnia event: LANsomnia It's always worth checking out
    a good LAN, and who knows what swag you may find yourself coming home with.....
  28. How Do I Test A Java Aplication
    (11)
    Well..can someone introduce me?(picture introduce is well)....
  29. How To Create An Online Timed Test With PHP?
    Can we do a online test with a counter(from 20 second) php for a php-n (17)
    Is there anyone got a online timed test script?Or anyone knows how to create this script? I wait
    your answers and all php programmers.....
  30. Test Your Robots.txt File With Google
    (6)
    As we all know, Robots are programs that traverse the Web automatically. Some people call
    them Crawlers or Spiders. Quite often, you need to restrict a robot lke (GoogleBOT) from
    crawling specific portion of your website. You can do it in two different ways. Firstly, it is done
    by including a specially formatted file on his site, namely robots.txt, in
    http://www.yourdomain.com/ robots.txt . Also Robots META tag(" special HTML META tag") may also
    be used to indicate if a page may or may not be indexed, or analysed for links by a crawler.
    Usually, a co....

    1. Looking for test, imagemagick, php

Searching Video's for test, imagemagick, php
Similar
Bomb
Test(amazing
) - sorry if
repost
Test Drive -
xbox 360
game
The Legacy
Of Holy
Castle
Closed Beta
Test Is Now
Live! -
Free
Strategy
Game
Free Online
Speed Test -
Post your
results here
Test Out Cms
And Other
Php Stuff -
Open-Source
CMS
Tremulous Is
A Free And
Open Source
Team-based
First-person
Shooter With
Real-time
Strategy
Elements -
Test it
!
Test
How To Make
An
Test-based
Rpg
Game! -
This is a
step by step
tutorial of
how to make
a RPG
test-based
game
Is Gre Test
Necessary In
Canada ? - a
guy from
Pakistan
needs to be
informed
Online Pc
Test
Ie8 Passes
Acid 2 Test
Ubuntu 7.04
- Test Drive
Internet
Speed Test -
Internet
Speed Test,
Post your
results here
!
Test What
Html Code
Looks Like
Inside Of A
Code Box
Free Gre
Test
Prep!
Test Drive
Unlimited -
Pc - The
latest Test
Drive -
ATARI game
Multiple
Versions Of
Ie - want to
test your
pages?
Windows
Vista -
Details and
Opinion Of
Vista - Beta
Test
Ketnsfiel Vs
Conroe -
test
IPmobile To
Test 42mbps
Cellular
Data
Firefox 3.0
Passes The
Acid Test
(finally)
Need An
Autoresponde
r? Free For
Life If You
Can Test It
Out - Beta
Testers
wanted
Should This
Great Site
Offer
Imagemagick
? - May be
the admin of
this site
think over
it.
Php
Script/tutor
ial Test
Site Another
Xisto
Service
Possibility
Online
Personality
Disorder
Test! -
Its fun ..
Do you think
it's any
good ?
How To Test
Drupal
Themes?
Test Your
Fps Skills
How Do I
Test A Java
Aplication
How To
Create An
Online Timed
Test With
PHP? - Can
we do a
online test
with a
counter(from
20 second)
php for a
php-n
Test Your
Robots.txt
File With
Google
advertisement




How To Find And Test Imagemagick Using Php



 

 

 

 

ADD REPLY / Got an Opinion! a humble request :-) RAPID SEARCH! Free Hosting [X]
Express your Opinions, Thoughts or Contribute more info. to help others.
Ask your Doubts & Queries to get answers, So that "Together We can help others!"
Register FREE for AD-FREE forum, Create your own topics, Ask Questions, track topics, setup subscriptions & notifications and Get a Free Website w/ Email and FTP.
500MB Space *No Ads*, CPanel, FTP, PHP, MySQL, EMails - 100% FREE