I have created a FFMPEG thumbnail in a php application and tried to rotate the thumbnail image if the video is bottom up(reversed).But the image rotate is not working properly.
The below is the code for image rotation

```
$video = $storeHere.$mediaFile;
                                $tImage = $upload_output['uploaded_file'].'.jpg';
                                $thumbnail = $storeHere.$tImage;
                                // shell command [highly simplified, please don't run it plain on your script!]
                                 shell_exec("ffmpeg -i $video -deinterlace -an -ss 1 -t 00:00:01 -r 1 -y -vcodec mjpeg -f mjpeg -s 250x250  $thumbnail 2>&1");
                                 /* image rotate fix */
                                    $source = imagecreatefromjpeg($thumbnail);
                                    $degrees = 270;
                                    $rotate = imagerotate($source, $degrees, 0);
                                    imagejpeg($rotate,$thumbnail);
                                 /* rotate fix ends */

```