-2

I am getting image from API without Extension.

How can I convert that to .jpg or .png in php?

For example: http://s7.asdcASD/is/image/SDCsaAS/59567_67106_MAIN

The last parameter is image name but without extension.

Funk Forty Niner
  • 74,450
  • 15
  • 68
  • 141

1 Answers1

0

If you are trying to save the image on disk and then open it, try to concat your string with the extension before saving.

E.g

<?php
        $a = "59567_67106_MAIN";
        $b = $a . ".jpg";    
?>
Victor Viola
  • 575
  • 1
  • 4
  • 14