1

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.

2 Answers 2

5

I encountered this issue when using one of Fred's ImageMagick scripts. The solution is to update the script file (scriptname.sh) using your favorite editor (vim, nano, etc) and set the correct temp directory. See below:

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

In my case the temp directoy was "/tmp"

# set directory for temporary files
dir="/tmp"    # suggestions are dir="." or dir="/tmp"
#
Sign up to request clarification or add additional context in comments.

2 Comments

Yep. I was using a tmp dir without write permission, i changed them and solved.
I have the same issue but only with JPG. With PNG file it works fine. My dir="/tmp"
-1

I am facing this issue when using textcleaner from Fred's ImageMagick scripts. Solution is use correct path tmp directory path

In My case

set directory for temporary files

dir="/var/www/html/textcleaner/images/" # suggestions are dir="." or dir="/tmp" #

This should be writable

Also the textcleaner.sh will also move to the project.

1 Comment

Please always see my Pointers for use on my home page at fmwconcepts.com/imagemagick/index.html

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.