custom last name feature on T-shirt prints.

A plethora of command-line scripts that perform geometric transforms, blurs, sharpens, edging, noise removal, and color manipulations.
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: custom last name feature on T-shirt prints.

Post by snibgo »

bmano wrote:./tshirt.sh
This means "the script called tshirt.sh in the current directory". When run in PHP, what is the "current directory"?
snibgo's IM pages: im.snibgo.com
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: custom last name feature on T-shirt prints.

Post by fmw42 »

I have used to send the parameters as Document root like, 'D:\xampp\htdocs\image.jpg'.
I am not a windows users, so do not know how to specify directories properly in PHP exec(). So Windows PHP user can provide more help.

But if you need \ for directories then you probably cannot use ./ for the path.
exec("bash ./tshirt.sh -a 1 -m l $in $back $out 2>&1")
My script has no -m argument! You need to provide a -r or -c argument for the script to know where to put the overlay image.

Also you must configure the script as per my Pointers on my home page. Be sure to make the script executable and provide the path to Imagemagick in the script or in your $PATH.

Try putting all the images in the same directory as the script and use actual file names not variables.

Start with one of my examples from my web site.

Try it as:

<?php
exec("bash tshirt.sh .... $in $back $out 2>&1",$out,$returnval);
foreach($out as $text)
{echo "$text<br>";}
?>

Fill in the proper arguments. Also be sure the script downloads as tshirt.sh and not tshirt. Be sure that you call the script exactly as the its name when downloaded or change the script name as desired to be consistent with now you want to call it.

Do you get any messages from the above?
bmano
Posts: 15
Joined: 2016-02-04T09:55:57-07:00
Authentication code: 1151

Re: custom last name feature on T-shirt prints.

Post by bmano »

Hi Thanks,

I got lot of messages from the previous post. I have moved the thist.sh script into the linux server and run the following commands:

Code: Select all

bash /var/sentora/hostdata/zadmin/public_html/getglamor_com/imagick/tshirt.sh -c "275,175 404,175 404,304 275,304" -f crop -g north /var/sentora/hostdata/zadmin/public_html/getglamor_com/imagick/Small-mario_thumb.png /var/sentora/hostdata/zadmin/public_html/getglamor_com/imagick/tshirt_gray.jpg /var/sentora/hostdata/zadmin/public_html/getglamor_com/imagick/final.png 2>&1
While run this command I am getting the error like this unrecognized virtual pixel method `none' @ error/convert.c/ConvertImageCommand/2940.
And some times I'm getting the commented lines in tshirt script in the terminal window.

If I'm trying to using this following code , Its working fine and get a result.

Code: Select all

convert /var/sentora/hostdata/zadmin/public_html/getglamor_com/imagick/tshirt_gray.jpg -pointsize 50 -font /var/sentora/hostdata/zadmin/public_html/getglamor_com/imagick/ariblk.ttf -gravity center -annotate +0+0 Naveen /var/sentora/hostdata/zadmin/public_html/getglamor_com/imagick/yogesh.jpg 2>&1
Is there anything wrong in my command?
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: custom last name feature on T-shirt prints.

Post by fmw42 »

What are the exact errors that you get from the PHP code that I suggested above when using my example images all at the same location as the script?

Does that fail the same way?

Can you provide your input images so I can test your command above? You can upload them to some place such as dropbox.com and put the URL here or send them to me privately by email to fmw at alink dot net

What do you get returned for

convert -version

when run via PHP exec() using the PHP structure

<?php
exec("convert -version",$out,$returnval);
foreach($out as $text)
{echo "$text<br>";}
?>

If that fails to return anything, put the full path to convert in the command
bmano
Posts: 15
Joined: 2016-02-04T09:55:57-07:00
Authentication code: 1151

Re: custom last name feature on T-shirt prints.

Post by bmano »

I just run this command in terminal.

I',m getting error while running this command in terminal as,
unrecognized virtual pixel method `none' @ error/convert.c/ConvertImageCommand/2940.

If I use bash before the command its return
--- UNKNOWN OPTION ---


tshirt.sh:


USAGE: tshirt [-r region] [-c coords] [-f] [-g gravity] [-v vshift]
...........
bmano
Posts: 15
Joined: 2016-02-04T09:55:57-07:00
Authentication code: 1151

Re: custom last name feature on T-shirt prints.

Post by bmano »

I get nothing but a blank page while running this following script in PHP.

<?php
exec("convert -version", $out, $returnval);
foreach($out as $text){
echo $text."<br>";
}
?>


here are the input images that I am trying to use:
https://www.dropbox.com/s/5xlmvgae7s2hs ... b.png?dl=0
https://www.dropbox.com/s/nzx8ww893u3en ... y.jpg?dl=0

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

Re: custom last name feature on T-shirt prints.

Post by fmw42 »

Try again, but put the full path to convert. I need to know what delegates you have and what version of Imagemagick is being used.

Those images are from my web site.

But what error messages did you get from the command to process those images in the PHP code when both images and output and script are in the same place? And what is your exact PHP code for this example?
bmano
Posts: 15
Joined: 2016-02-04T09:55:57-07:00
Authentication code: 1151

Re: custom last name feature on T-shirt prints.

Post by bmano »

I'm using ImageMagick Version : ImageMagick 6.6.9-7 2014-03-06 Q16.

I'm getting error " convert: unrecognized virtual pixel method `none' @ error/convert.c/ConvertImageCommand/2940. " while using the following PHP script.

Code: Select all

<?php
exec("bash /var/sentora/hostdata/zadmin/public_html/getglamor_com/imagick/tshirt.sh -r 130x130+275+175 /var/sentora/hostdata/zadmin/public_html/getglamor_com/imagick/Small-mario_thumb.png /var/sentora/hostdata/zadmin/public_html/getglamor_com/imagick/tshirt_gray.jpg /var/sentora/hostdata/zadmin/public_html/getglamor_com/imagick/final.png 2>&1", $out, $returnval); 

foreach($out as $text){
	echo $text."<br>";
}
?>   
Yes, tshirt.sh and index.php file as well as all input and output image files are in same place.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: custom last name feature on T-shirt prints.

Post by fmw42 »

This command works fine for me with no errors using IM 6.9.3.3. Q16 Mac OSX

Code: Select all

tshirt -r "130x130+275+175" -R -3 -o 5,0 Small-mario_thumb.png tshirt_gray.jpg tmp.png
My guess is that your ancient version of Imagemagick has a bug in it. Version 6.6.9.7 is over 230 versions old. I suggest that you upgrade your version of Imagemagick. I would suggest you upgrade to the latest version, but at least 6.8.6.0 to avoid other color and grayscale issues that were being made starting with about your version of IM. See viewtopic.php?f=4&t=21269.

Before upgrading, you might try editing line 623 from

Code: Select all

	\( $dir/tmpI.mpc $cropping -virtual-pixel none +distort perspective \
to

Code: Select all

	\( $dir/tmpI.mpc $cropping -virtual-pixel transparent +distort perspective \
and see if that makes any difference.
bmano
Posts: 15
Joined: 2016-02-04T09:55:57-07:00
Authentication code: 1151

Re: custom last name feature on T-shirt prints.

Post by bmano »

fmw42 wrote:This command works fine for me with no errors using IM 6.9.3.3. Q16 Mac OSX

Code: Select all

tshirt -r "130x130+275+175" -R -3 -o 5,0 Small-mario_thumb.png tshirt_gray.jpg tmp.png
My guess is that your ancient version of Imagemagick has a bug in it. Version 6.6.9.7 is over 230 versions old. I suggest that you upgrade your version of Imagemagick. I would suggest you upgrade to the latest version, but at least 6.8.6.0 to avoid other color and grayscale issues that were being made starting with about your version of IM. See viewtopic.php?f=4&t=21269.

Before upgrading, you might try editing line 623 from

Code: Select all

	\( $dir/tmpI.mpc $cropping -virtual-pixel none +distort perspective \
to

Code: Select all

	\( $dir/tmpI.mpc $cropping -virtual-pixel transparent +distort perspective \
and see if that makes any difference.
Thank you for the help. Sorry for getting back a bit late, as I was setting up the servers from scratch and after multiple attempts I have now successfully installed both Imagemagick 6.9.3-5 and Imagick 3.3.0 on my server. I tried the commands on your above post using shell script and it worked fine!!

But now I have to get the same output using Imagick, could you please tell me the functions that has to be used using Imagick to attain the same desired effect? For example a wrinkle effect like this: https://easytweaks.wordpress.com/tag/wr ... xt-effect/ ? Thank you!
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: custom last name feature on T-shirt prints.

Post by fmw42 »

Sorry, I do not use Imagick and I do not think you can run my scripts from Imagick. You will need to use PHP exec() as far as I know.
bmano
Posts: 15
Joined: 2016-02-04T09:55:57-07:00
Authentication code: 1151

Re: custom last name feature on T-shirt prints.

Post by bmano »

fmw42 wrote:Sorry, I do not use Imagick and I do not think you can run my scripts from Imagick. You will need to use PHP exec() as far as I know.
Many system administrators suggested me that running on exec() command puts the server vulnerable to threats. Also, my main target is to integrate this feature on the site, which way a user can customize the text on the tshirt like I mentioned in my OP. I tried searching for functions in the imagick, but I am still unlucky to get hold of the right functions to achieve the wrinkle effect. :(

Hoping someone could gimme a heads up on this.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: custom last name feature on T-shirt prints.

Post by fmw42 »

For Imagick commands and issue, I suggest you post your question on the Imagick forum section of this server. But my scripts do not run under Imagick.
Post Reply