0

My company's web server uses the command below to upload images to $argAsset->path. The image file name is a random number followed by '.' followed by another random number.

exec('/usr/bin/convert ' . $argAsset->path . ' ' . $argAsset->path . '.png');

I'm currently testing image upload with the exact same image each time. Sometimes this command generates a single image, and sometimes it generates multiple images. How does one make sure that ImageMagick only generates a single image for this command?

huysentruitw
  • 27,376
  • 9
  • 90
  • 133
npCompleteNoob
  • 481
  • 1
  • 5
  • 15
  • Are there spaces in the paths? – ceejayoz May 23 '16 at 18:42
  • 2
    maybe you have gifs/pdfs there, and every frame(gif) or page(pdf) goes into different file – strangeqargo May 23 '16 at 18:44
  • 1
    Possible duplicate of [How to execute ImageMagick to convert only the first page of the multipage PDF to JPEG?](http://stackoverflow.com/questions/12614801/how-to-execute-imagemagick-to-convert-only-the-first-page-of-the-multipage-pdf-t) – huysentruitw May 23 '16 at 18:50
  • 1
    I think you need to confirm the type of image you are converting and the Imagemagick version may be useful. One thing I would suggest is use " around your file path. Also a simple test of a static filename in your code and from the same folder as the code may give some insight. – Bonzo May 23 '16 at 19:16

0 Answers0