Ich habe ein paar Tutorials gefunden, um Bild in PHP zu bearbeiten. Es zeigt jedoch ein schwarzes Bild. Ich konnte nicht verstehen, was das Problem hier ist.Schwarzes Bild bei der Bearbeitung durch PHP
<?php
//Set the Content Type
header('Content-type: image/jpeg');
// Create Image From Existing File
$jpg_image = imagecreatefromjpeg('http://iamsaurav.xyz/images/avatar.jpg');
// Allocate A Color For The Text
$white = imagecolorallocate($jpg_image, 255, 255, 255);
// Set Path to Font File
$font_path = 'http://iamsaurav.xyz/images/oswald.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);
// Send Image to Browser
imagejpeg($jpg_image);
// Clear Memory
imagedestroy($jpg_image);
?>
Diese Verknüpfung verweist auf das Zuschneiden des Bildes. Aber hier versuche ich einen Text zum Bild hinzuzufügen –