Looking for help with some advanced text features

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
palloquin
Posts: 3
Joined: 2012-01-09T09:00:47-07:00
Authentication code: 8675308

Looking for help with some advanced text features

Post by palloquin »

Hi all,

I hope posting this kind of request here is not improper.

I am working on a project where I would need to dynamically create images with text on them. This will most likely include text on a wave path, and some other fancy features. Now, I'm quite an experienced programmer, but have very little experience working on the Linux platform. I could do with some help. We have (some) budget available for someone who would be willing to help out a bit.

Is there someone out there who can do fancy IM tricks with text in PHP that is willing to talk this through with me? I would be very grateful!

Kindest regards,

Palloquin
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Looking for help with some advanced text features

Post by fmw42 »

see my texteffect script. It can be run from PHP. See notes about that at the top of the home page at the link below.
palloquin
Posts: 3
Joined: 2012-01-09T09:00:47-07:00
Authentication code: 8675308

Re: Looking for help with some advanced text features

Post by palloquin »

fmw42... you rock! thank you!

This just made things look easy(-ish :wink: ) I'll try my hand at this and see what I can do with it!

Thank you agian!
palloquin
Posts: 3
Joined: 2012-01-09T09:00:47-07:00
Authentication code: 8675308

Re: Looking for help with some advanced text features

Post by palloquin »

Hi Fred,

I'm getting stuck on just having too limited PHP knowledge... Do you know of an example out there somewhere that is actually a full PHP page doing something with one of your scripts? I'm sure I can adapt that to get it to work with your text scripts... It's just that first step....

Thank you!!!
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Looking for help with some advanced text features

Post by fmw42 »

palloquin wrote:Hi Fred,

I'm getting stuck on just having too limited PHP knowledge... Do you know of an example out there somewhere that is actually a full PHP page doing something with one of your scripts? I'm sure I can adapt that to get it to work with your text scripts... It's just that first step....

Thank you!!!
See user Bonzo's web site Rubblewebs at http://www.rubblewebs.co.uk/index.php. But I do not know if he has any examples using my scripts.

The main issues are identified on my home page:



Pointers for use:
1)Download the script
2)Change the name to add or remove the .sh as desired when running
3)Set the script to executable (chmod u+x)
4)Edit the script to add the full path to convert, identify and any other IM command
5)Edit the script to change the default directory (found after the defaults section) from dir="." to dir="/tmp"
6)In the exec command use bash /fullpathto/scriptname(.sh) arguments /fullpathto/inputimage /fullpathto/outputimage.
7)Note that "bash" may or may not be necessary


The critical one is step 4. That can be a lot of work to find every command and put the full path to it. I have been working on developing changes to my scripts to help in this regard, but I have not had time to go about editing every script. But here is a quick fix.

Find out your path to IM via

which convert

In PHP, use

<?php
echo "<pre>";
system("which -a convert");
echo "</pre>";
?>

Then edit the script (it is simple text file) to add just below the line under the argument defaults where it says

# set directory for temporary files
dir="." # suggestions are dir="." or dir="/tmp"


and put the following:


imdir="/usr/local/bin"

# set up aliases to IM functions
if [ "$imdir" != "" ]; then
alias animate="$imdir/animate"
alias compare="$imdir/compare"
alias composite="$imdir/composite"
alias conjure="$imdir/conjure"
alias convert="$imdir/convert"
alias display="$imdir/display"
alias identify="$imdir/identify"
alias import="$imdir/import"
alias mogrify="$imdir/mogrify"
alias montage="$imdir/montage"
alias stream="$imdir/stream"
fi

Replace imdir=... with your path to IM from which convert.

Then follow the remaining directions from above.

Let me know if you still have trouble. Show me you PHP exec command if still having trouble.

Fred

P.S.

Here is one example:

<?php
exec("bash /Users/fred/Applications/bin/cylinderize -m vertical -p 20 img5967.jpg img5967_cyl.jpg 2>&1",$out,$returnval);
foreach($out as $text)
{echo "$text<br>";}
?>

The 2>&1 and $out allow any error messages to captured. The foreach then prints each line of the messages.

This is useful for debugging, but is not necessary afterwards.

Depending upon your PHP and system setup, the bash and/or the path to your script may or may not be necessary (as well as full paths to your images depending upon where they are located)
Post Reply