Help out ffmpeg with Cropping an Image File(spec)

RJM Programming - April, 2019

Thanks to https://www.oodlestechnologies.com/blogs/Crop-and-scale-image-using-ffmpeg

Input Image File(spec):
from Left: Top:
... by ... Width: and Height:
  
"; } else if (isset($_GET['awidth']) && isset($_GET['aheight'])) { // && isset($_GET['aleft']) && isset($_GET['atop'])) { $replines=""; foreach (glob(str_replace("+", " ", urldecode($_GET['animage']))) as $ifil) { $ext = "." . explode(".", $ifil)[-1 + sizeof(explode(".", $ifil))]; $datau = "data:image/" . strtolower(substr($ext,1)) . ";base64,"; $noext = str_replace($ext, "", $ifil); $suff = 0; while (file_exists(dirname(__FILE__) . '/' . $noext . "_" . $suff . $ext)) { $suff++; } if (isset($_GET['AspectScale'])) { $replines.="'; exec('/usr/local/bin/ffmpeg -i ' . dirname(__FILE__) . '/' . $ifil . ' -vf "scale=' . str_replace("+", " ", urldecode($_GET['awidth'])) . ':ih*' . str_replace("+", " ", urldecode($_GET['aheight'])) . '/iw" ' . dirname(__FILE__) . '/' . $noext . "_" . $suff . $ext); $replines.=""; } else if (isset($_GET['Scale'])) { $replines.="'; exec('/usr/local/bin/ffmpeg -i ' . dirname(__FILE__) . '/' . $ifil . ' -vf "scale=' . str_replace("+", " ", urldecode($_GET['awidth'])) . ':' . str_replace("+", " ", urldecode($_GET['aheight'])) . '" ' . dirname(__FILE__) . '/' . $noext . "_" . $suff . $ext); $replines.=""; } else { $replines.="'; exec('/usr/local/bin/ffmpeg -i ' . dirname(__FILE__) . '/' . $ifil . ' -vf "crop=' . str_replace("+", " ", urldecode($_GET['awidth'])) . ':' . str_replace("+", " ", urldecode($_GET['aheight'])) . ':' . str_replace("+", " ", urldecode($_GET['aleft'])) . ':' . str_replace("+", " ", urldecode($_GET['atop'])) . '" ' . dirname(__FILE__) . '/' . $noext . "_" . $suff . $ext); $replines.=""; } } $replines.="
Scaling (keeping aspect ratio) " . $ifil . ' via ' . 'ffmpeg -i ' . $ifil . ' -vf "scale=' . str_replace("+", " ", urldecode($_GET['awidth'])) . ':ih*' . str_replace("+", " ", urldecode($_GET['aheight'])) . '/iw" ' . $noext . "_" . $suff . $ext . '
Scaling " . $ifil . ' via ' . 'ffmpeg -i ' . $ifil . ' -vf "scale=' . str_replace("+", " ", urldecode($_GET['awidth'])) . ':' . str_replace("+", " ", urldecode($_GET['aheight'])) . '" ' . $noext . "_" . $suff . $ext . '
Cropping " . $ifil . ' via ' . 'ffmpeg -i ' . $ifil . ' -vf "crop=' . str_replace("+", " ", urldecode($_GET['awidth'])) . ':' . str_replace("+", " ", urldecode($_GET['aheight'])) . ':' . str_replace("+", " ", urldecode($_GET['aleft'])) . ':' . str_replace("+", " ", urldecode($_GET['atop'])) . '" ' . $noext . "_" . $suff . $ext . '
"; echo " Help out ffmpeg with Cropping an Image File(spec) - RJM Programming - April, 2019 ... thanks to https://www.oodlestechnologies.com/blogs/Crop-and-scale-image-using-ffmpeg

Help out ffmpeg with Cropping an Image File(spec)

RJM Programming - April, 2019

Thanks to https://www.oodlestechnologies.com/blogs/Crop-and-scale-image-using-ffmpeg

" . $replines . "

Input Image File(spec):
from Left: Top:
... by ... Width: and Height:
  
"; } ?>