图像保存在特定文件夹中并在PHP中返回该图像路径

I am trying to generate a barcode and save into one folder, and after save I want path of that image. Here is the code:

header('Content-type: image/jpeg');
  imagejpeg($im); 
    echo  $save = "temp/". strtolower($code) .".jpeg";   
    // $save1 = $_SERVER['DOCUMENT_ROOT'] . "/sigs/" . strtolower($name) . ".png";
$tt= imagejpeg($im, $save);
  imagedestroy($im);

The image saves successfully, but path does not return or even print - what might be wrong?

but path not return or even not print please help me

Of course it does not. It prints 1 as expected. What you got wrong is this line:

echo  $save = "temp/". strtolower($code) .".jpeg"; 

it should be:

$save = "temp/". strtolower($code) .".jpeg"; 
echo $save;

instead.