Jump to content

[Krydos] new tommy: PHP 5.6 and GD library: Problem "no Text in Images"


dl5ark1

Recommended Posts

I am experiencing an issue with generating images using a PHP script from the MyBlitzortung project (https://github.com/tobiasv/MyBlitzortung/tree/master) after moving my website from the old tommy2 server to the new tommy server. The script uses the GD library to render images with text, but after the move, no text is displayed in the images.

To investigate, I ran two simple test scripts:

gd.php (https://dl5ark.heliohost.org/gd.php): This test creates a blank image with a black background and attempts to display text using a specific TTF font, but only a white rectangle is shown without the text.
gd1.php (https://dl5ark.heliohost.org/gd1.php): Similarly, this script also fails to display the text.
The PHP script in question (functions_image.inc.php) relies on the GD library with FreeType support to render the text, and the path to the TTF font seems to be correctly configured. The issue persists even though:
- FreeType support is enabled on the server.
- The font files are present and accessible with appropriate permissions.

I kindly request your help to:
1. Verify if the GD library with FreeType is functioning correctly on the new server.
2. Check for any potential issues with the PHP configuration (e.g., paths, library versions, or limitations) that might prevent the text rendering from working properly.

I appreciate your assistance in resolving this issue, as it affects the proper functioning of image generation on the website.

Wolstech has also tested it and confirms the problem with PHP 6.5 and the GD library (GD is broken): https://helionet.org/index/topic/62191-tommy-upgrade/?do=findComment&comment=279291 .

Thank you for your help, best regards!

Link to comment
Share on other sites

  • wolstech changed the title to [Krydos] new tommy: PHP 5.6 and GD library: Problem "no Text in Images"

Copying the script to my account -- which was created directly on Plesk instead of being created on cPanel a millennia ago and then transferred to Plesk -- works fine

https://krydos1.heliohost.org/gd.php

image.png.f3860a55c7a439de15474e3344534223.png

<?php

// Header, um den Bildinhalt als PNG auszugeben
header('Content-Type: image/png');

// Erstelle ein leeres Bild (800x200 Pixel)
$im = imagecreatetruecolor(800, 200);

// Definiere Farben
$bg = imagecolorallocate($im, 255, 255, 255); // Weißer Hintergrund
$text_color = imagecolorallocate($im, 0, 0, 0); // Schwarzer Text

// Fülle das Bild mit der Hintergrundfarbe
imagefilledrectangle($im, 0, 0, 799, 199, $bg);

// Pfad zur Schriftart
$font_path = './DejaVuSansMono-Oblique.ttf';

// Füge den Text hinzu (Schriftgröße 40, X=50, Y=100)
imagettftext($im, 40, 0, 50, 100, $text_color, $font_path, 'Hallo, Welt!');

// Ausgabe des Bildes im PNG-Format
imagepng($im);

// Bild im Speicher freigeben
imagedestroy($im);

I've lost count of how many times I've encouraged you to reset your account so far.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...