Who can help me?

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
userman
Posts: 12
Joined: 2010-09-12T10:58:46-07:00
Authentication code: 8675308

Who can help me?

Post by userman »

Hi,

I am new here, i have a mini script but the script dont work in my server. The script for gif animation dont work, but the script for png only yes work. I dont know why.

I use ImageMagick 6.2.8

Who can check it for fix it please. I can pay a little dolars via paypal if you want it.

Code: Select all

<?
$surse = "123qwertyu456789QWERThjklzYUIOPAxcvSDFGHVBNMiopasdfgbnmJKLZXC"; 

for ($i = 0; $i <15; $i++) 
    { 
     $newsurse[$i] = $surse[rand(0,60)];
	 $newsurse2[$i] = $surse[rand(0,60)];
    } 
	
   	$png = 'temp/'.implode("",$newsurse).'.png';
   	$gif = 'temp/'.implode("",$newsurse2).'.gif';
exec('convert '.$imagesurse2.' -resize 170!x188! '.$imagesurse2.'');

exec("convert ".$patch."/mask.png  ".$imagesurse2." +clone -compose hardlight -composite ".$png);
exec('convert '.$patch.'/template.gif  null: '.$png.'  -geometry +50+5 -layers Composite '.$gif.'');

@unlink($imagesurse2);
@unlink($png);
$imagesurse2=$gif;
?>
Bonzo
Posts: 2971
Joined: 2006-05-20T08:08:19-07:00
Location: Cambridge, England

Re: Who can help me?

Post by Bonzo »

In what way does it not work?

This line is incorrect as you need to escape the '

Code: Select all

exec('convert '.$patch.'/template.gif  null: '.$png.'  -geometry +50+5 -layers Composite '.$gif.'');
I would guess it needs to be:

Code: Select all

exec("convert '.$patch.'/template.gif  null: '.$png.'  -geometry +50+5 -layers Composite '.$gif.' ");
I would write it as:

Code: Select all

exec("convert $patch/template.gif  null: $png  -geometry +50+5 -layers Composite $gif ");
userman
Posts: 12
Joined: 2010-09-12T10:58:46-07:00
Authentication code: 8675308

Re: Who can help me?

Post by userman »

I get the error:

PHP Warning: getimagesize(temp/YaOV8qgm8ZFlN5L.gif) [<a href='function.getimagesize'>function.getimagesize</a>]: failed to open stream: No such file or directory in /home/web/generate.php on line 36, referer: http://www.domain.com/image.php

I think that the script dont generate the .gif ...

The problem can be the version of imagemagick?

and the script for png only yes work:

Code: Select all

<?
$surse = "123qwertyu456789QWERThjklzYUIOPAxcvSDFGHVBNMiopasdfgbnmJKLZXC"; 

for ($i = 0; $i <15; $i++) 
    { 
     $newsurse[$i] = $surse[rand(0,60)];
	 $newsurse2[$i] = $surse[rand(0,60)];
    } 
   
   	$jpg = 'temp/'.implode("",$newsurse).'.jpg';
exec('convert '.$imagesurse2.' -resize 265!x333! '.$imagesurse2.'');

exec("convert  ".$patch."/banner104.png  ".$imagesurse2." -geometry +93+185 -compose DstOver -composite  ".$jpg);
exec('convert '.$jpg.' -quality 60 '.$jpg);
@unlink($imagesurse2);
$imagesurse2=$jpg;
?>
Bonzo
Posts: 2971
Joined: 2006-05-20T08:08:19-07:00
Location: Cambridge, England

Re: Who can help me?

Post by Bonzo »

Try echoing your values to see they are what you expect and add some error reporting to the exec commands:

I do not like the way you write your code as it is very confusing and the problem is probably using ' and " everywhere. For instance this line exec("convert ".$patch."/banner104.png ".$imagesurse2." -geometry +93+185 -compose DstOver -composite ".$jpg); is missing a " before the ); and I think the " need escaping anyway.

Code: Select all

<?
$surse = "123qwertyu456789QWERThjklzYUIOPAxcvSDFGHVBNMiopasdfgbnmJKLZXC"; 

for ($i = 0; $i <15; $i++) 
    { 
     $newsurse[$i] = $surse[rand(0,60)];
    $newsurse2[$i] = $surse[rand(0,60)];
    } 
   
      $jpg = 'temp/'.implode("",$newsurse).'.jpg';

$array=array();
echo "<pre>";
$cmd = " $imagesurse2 -resize 265!x333! ";
exec("convert $cmd $imagesurse2 2>&1", $array); 
echo "<br>".print_r($array)."<br>"; 
echo "</pre>";

$array=array();
echo "<pre>";
$cmd = " $patch/banner104.png  $imagesurse2 -geometry +93+185 -compose DstOver -composite  ";
exec("convert $cmd $jpg 2>&1", $array); 
echo "<br>".print_r($array)."<br>"; 
echo "</pre>";

// Why do you have this line - you can add it to the one above?
exec('convert '.$jpg.' -quality 60 '.$jpg);

@unlink($imagesurse2);

// Again why this line ? if you saved as this above it would overwrite $imagesurse2 anyway
$imagesurse2=$jpg;
?>
Try getting something simple working first by hard coding the files into the code and move onto the dynamic part when it works.
userman
Posts: 12
Joined: 2010-09-12T10:58:46-07:00
Authentication code: 8675308

Re: Who can help me?

Post by userman »

Bonzo, you dont understand me.

Sorry for my bad english.

I have 2 scripts, 1 for png only and another for gif animation. the script for png only WORK good, but the script for gif animation DONT WORK...

before I copy here the 2 scripts...
userman
Posts: 12
Joined: 2010-09-12T10:58:46-07:00
Authentication code: 8675308

Re: Who can help me?

Post by userman »

I have fixed.

Solution:

Update from ImageMagick 6.2.8 to ImageMagick 6.6.4


Regards
Post Reply