脚本适用于本地,但不适用于实时

I am trying to write text on an image. It works fine on local system, but it is not working when I upload it to live server. My code is

        $imgPath = base_url() . "public/images/mix/theatre.jpg";
        $jpg_image = imagecreatefromjpeg($imgPath);

        // Allocate A Color For The Text
        $color = imagecolorallocate($jpg_image, 102, 20, 99);

        // Set Path to Font File
       $font_path = FCPATH . "public/fonts/Myriad Pro.TTF";
        //echo $font_path = base_url()."/public/fonts/Myriad Pro.TTF";
        // Set Text to Be Printed On Image
        $text = "NOW SHOWING";

        // Print Text On Image

        $imagettf = imagettftext($jpg_image, 16, 0, 57, 140, $color, $font_path, $text);
        $savedImage = imagejpeg($jpg_image, $saveToPath);
        var_dump($savedImage);

it gives me the same image which i copied from $imgPath, text is not written on it

You can use this code

<?php
header('Content-type: image/png');
$im = imagecreatefromjpeg('includes/dir/something.jpg');
$black = imagecolorallocate($im, 0, 0, 0);
$text=strtolower("NOW SHOW");
$font = 'includes/dir/some.TTF';
imagettftext($im, 25, 0, 15, 33, $black, $font, $text);
imagepng($im);
imagedestroy($im);  
?>

its work for me

Are you sure your font is available in remote? Also it seems you are missing the slash:

$font_path = FCPATH . "public/fonts/Myriad Pro.TTF";
                      ^^^^