I have to create a transition sequence of images, using Fred's ImageMagick scripts,in particular fx transitions.
In my php code, I resize all the images i got to a standard size, then I rename all those pictures to something like pic000001.jpg, pic000002.jpg, pic000003.jpg and so on (i keep count with $count), then I do:
$frameIndex=0;
$frames=18;
//for all the pic000001.jpg, pic000002.jpg, pic000003.jpg.... do a transition
//between them
for($seq=1;$seq<$count;$seq++){
//here I take a picture and the next(IE pic000001 and pic000002)
echo shell_exec("fxtransitions -e swirl -f $frames -d 20 -p 50 $path/pic".str_pad($seq, 6, '0', STR_PAD_LEFT).".jpg $path/pic".str_pad(($seq+1), 6, '0', STR_PAD_LEFT).".jpg $path/fx%06d.jpg");
//here I rename the temporany frames called
//fx000000.jpg to fx000035.jpg for each transition
//to a common index
for($c=0;$c<($frames*2);$c++){
rename("fx".str_pad($c, 6, '0', STR_PAD_LEFT).".jpg" ,str_pad($frameIndex, 6, '0', STR_PAD_LEFT).".jpg");
$frameIndex++;
}
}
Then, I use FFMpeg to combine all frames and make a video. The problem is that fxtransition states an error:
--- FILE DOES NOT EXIST OR IS NOT AN ORDINARY FILE, NOT READABLE OR HAS ZERO SIZE ---
(which is a message generated by the script for sure), followed by messages like this:
Warning: rename(fx000000.jpg,000000.jpg): No such file or directory in /var/www/html/TEST/APP/generateVideo.php on line 168
because the pictures weren't generated (it reveals that the aloghoritm for numbering the frame is correct, so don't focus on that).
If I open the terminal on the server, with a ssh connection and I run that command, it gives me the same error, unless I use sudo. If I use sudo on php shell_exec, it won't exec. shell_exec('whoami') returns apache, and apache is the owner of all the folders and files I involve in those functions.
Some help please? If you have an alternative to fred's imagemagick's scripts to generate transition frames to generate a video it will also be appreciated.