Glenskie Posted March 27, 2014 Share Posted March 27, 2014 I want to save a caption to a file but for some reason it will not save the file ? here is the code that i am working with ... $directory = "'useruploadedphotos/53346044e7cb6.jpg'"; imagejpeg($jpg_image, $directory); Quote Link to comment https://forums.phpfreaks.com/topic/287339-imagejpeg-not-working/ Share on other sites More sharing options...
Solution Ch0cu3r Posted March 27, 2014 Solution Share Posted March 27, 2014 Remove the single quotes. They are not needed Quote Link to comment https://forums.phpfreaks.com/topic/287339-imagejpeg-not-working/#findComment-1474161 Share on other sites More sharing options...
Glenskie Posted March 27, 2014 Author Share Posted March 27, 2014 still nothing here is all of my code... <?php //Set the Content Type header('Content-type: image/jpeg'); if (isset($_GET['image'])){ $picture = $_GET['image']; // Create Image From Existing File $jpg_image = imagecreatefromjpeg("useruploadedphotos/$picture"); // Allocate A Color For The Text $white = imagecolorallocate($jpg_image, 255, 255, 255); // Set Path to Font File $font_path = 'fonts/Timeless-Bold.ttf'; // Set Text to Be Printed On Image $text = "This is a sunset!"; // Print Text On Image imagettftext($jpg_image, 25, 0, 75, 300, $white, $font_path, $text); $directory = "/useruploadedphotos/$picture"; imagejpeg($jpg_image, "useruploadedphotos/$picture"); // Clear Memory imagedestroy($jpg_image); } else{ die('eror'); } ?> Quote Link to comment https://forums.phpfreaks.com/topic/287339-imagejpeg-not-working/#findComment-1474168 Share on other sites More sharing options...
Ch0cu3r Posted March 27, 2014 Share Posted March 27, 2014 If you comment the header() line are any errors shown? Quote Link to comment https://forums.phpfreaks.com/topic/287339-imagejpeg-not-working/#findComment-1474175 Share on other sites More sharing options...
Glenskie Posted March 27, 2014 Author Share Posted March 27, 2014 i just got it to work ! thank you ! Quote Link to comment https://forums.phpfreaks.com/topic/287339-imagejpeg-not-working/#findComment-1474188 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.