图像上传并保存在一个PHP脚本中

I want to upload a image from a remote server to my current server (server and backend migration) i am using laravel 4 and this is a 1 time use script so no need to worry about protecting it.

        if (strpos($check_image_arr['url'], '/product/'))
            {
        try
            {
                if (! file_exists ( "$destinationPath"))
                {
            mkdir("$destinationPath", 0777);
                }
            copy($check_image_arr['url'],$destinationPath."temp.jpg");
            echo "<img src=$destinationPath"."$filename >";

            $file          = file_get_contents($destinationPath);
            $destinationPath = public_path().'/img/product_images/'.'$check->id';
            $filename        = '$check->id'.".png";
            $uploadSuccess   = $file->move($destinationPath, $filename);
            die;


            }
        catch (Exception $e)
            {
            echo "$e";
            die;

            }

any suggestions will help thanks.

EDIT:: i found my solution

if (strpos($check_image_arr['url'], '/product/'))
    {

        if (! file_exists ( "$destinationPath"))
        {
    mkdir("$destinationPath", 0777);
        }
    copy($check_image_arr['url'],$destinationPath."temp.jpg");
    imagepng(imagecreatefromstring(file_get_contents(__DIR__."/img/product_images/"."$check->id"."/"."temp.jpg")),"temp.png");
    copy("temp.png",$destinationPath.$filename);
    }