• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

[GESIOR] Image does not appear

Hyagosrs

Member
Joined
Mar 10, 2018
Messages
94
Solutions
1
Reaction score
11
where it was to show written things, it shows me this error box image.
Screenshot_2.png

anyone can help me? when i click to see where is this error image is from:
Lua:
/headline.php?text=News%20Ticker
this is my headline.php:
Code:
<?php
require_once "../custom_scripts/gd-text/Box.php";
require_once "../custom_scripts/gd-text/Color.php";
require_once "../custom_scripts/gd-text/HorizontalAlignment.php";
require_once "../custom_scripts/gd-text/TextWrapping.php";
require_once "../custom_scripts/gd-text/VerticalAlignment.php";
require_once "../custom_scripts/gd-text/Struct/Point.php";
require_once "../custom_scripts/gd-text/Struct/Rectangle.php";

use GDText\Box;
use GDText\Color;

$text = $_REQUEST['txt'];


$im = imagecreatetruecolor(250, 28);
$backgroundColor = imagecolorallocate($im, 0, 0, 0);
imagefill($im, 0, 0, imagecolortransparent($im, null));


$box = new Box($im);
$box->setFontFace("../images/martel.ttf"); // http://www.dafont.com/elevant-by-pelash.font
$box->setFontSize(24);
$box->setFontColor(new Color(240, 209, 164));
$box->setBox(4, -4, 260, 28);
$box->setTextAlign('left', 'top');

$box->setStrokeColor(new Color(1, 1, 1)); // Set stroke color
$box->setStrokeSize(0); // Stroke size in pixels

$box->draw($text); // Text to draw

header("Content-type: image/png;");
imagepng($im, null, 0, PNG_ALL_FILTERS);
die();

/*
    $text = $_GET['txt'];
    $text = strtoupper($text[0]).substr($text,1,strlen($text));
    $size = 18;
    $sizex = 280;
    $sizey = 28;
    $x = 4;
    $y = 20;
    $color = 'efcfa4';
        $red = (int)hexdec(substr($color,0,2));
        $green = (int)hexdec(substr($color,2,2));
        $blue = (int)hexdec(substr($color,4,2));
    $img = imagecreatetruecolor($sizex,$sizey);
    ImageColorTransparent($img, ImageColorAllocate($img,0,0,0));
    
    imagefttext($img, $size, 0, $x, $y, ImageColorAllocate($img,$red,$green,$blue), '../images/martel.ttf', $text);
    
    header('Content-type: image/png');
    imagepng($img);
    imagedestroy($img);
*/
 
does the image exist in the correct folder?

did you configure your vhost.conf to grant access to everything?
like mine

<VirtualHost *:8080>
ServerName yourOtNameHere
ServerAlias yourOtNameHere
DocumentRoot "${INSTALL_DIR}/www/yourFolderHere"
<Directory "${INSTALL_DIR}/www/yourFolderHere">

Options +Indexes +Includes +FollowSymLinks +MultiViews
AllowOverride All
Require all granted
</Directory>
</VirtualHost>

I'm using wampp so the directory is /www/, you might be using xampp so it has to be on /htdocs/
 
does the image exist in the correct folder?

did you configure your vhost.conf to grant access to everything?
like mine

<VirtualHost *:8080>
ServerName yourOtNameHere
ServerAlias yourOtNameHere
DocumentRoot "${INSTALL_DIR}/www/yourFolderHere"
<Directory "${INSTALL_DIR}/www/yourFolderHere">

Options +Indexes +Includes +FollowSymLinks +MultiViews
AllowOverride All
Require all granted
</Directory>
</VirtualHost>

I'm using wampp so the directory is /www/, you might be using xampp so it has to be on /htdocs/

im trying to find this archive, but the only part i have my server path is in config/config.php
Lua:
# Account Maker Config
$config['site']['serverPath'] = "/home/linux/otserv/";
$config['site']['encryptionType'] = 'sha1';
$config['site']['useServerConfigCache'] = false;
 
Try replace headline.php with this:
PHP:
<?php
    if(strlen($_GET['txt']) > 100) // max limit
        $_GET['txt'] = '';

    // set font path
    putenv('GDFONTPATH=' . __DIR__);

    // create image
    $image = imagecreatetruecolor(250, 28);

    // make the background transparent
    imagecolortransparent($image, imagecolorallocate($image, 0, 0, 0));

    // set text
    imagettftext($image, 18, 0, 4, 20, imagecolorallocate($image, 240, 209, 164), 'martel.ttf', utf8_decode($_GET['txt']));

    // header mime type
    header('Content-type: image/gif');

    // save image
    imagegif($image/*, $file*/);
?>

Also, keep that change with "txt".
 
Try replace headline.php with this:
PHP:
<?php
    if(strlen($_GET['txt']) > 100) // max limit
        $_GET['txt'] = '';

    // set font path
    putenv('GDFONTPATH=' . __DIR__);

    // create image
    $image = imagecreatetruecolor(250, 28);

    // make the background transparent
    imagecolortransparent($image, imagecolorallocate($image, 0, 0, 0));

    // set text
    imagettftext($image, 18, 0, 4, 20, imagecolorallocate($image, 240, 209, 164), 'martel.ttf', utf8_decode($_GET['txt']));

    // header mime type
    header('Content-type: image/gif');

    // save image
    imagegif($image/*, $file*/);
?>

Also, keep that change with "txt".

no does not work. :( i really doen't think the problem is with headline.php.. i believe is about permissions or serverpath, i don't know
 
1)

Do you have this font in your layouts/tibiacom folder? File: "martel.ttf"

2)

If you use linux, you might need to install php-gd library.

apt-get install php-gd

Then restart apache/nginx.
 
1)

Do you have this font in your layouts/tibiacom folder? File: "martel.ttf"

2)

If you use linux, you might need to install php-gd library.

apt-get install php-gd

Then restart apache/nginx.

1) i only see martel.tff in /images folder

2) i already have this lib

should i change martel.ttf folder?
 
Would be easier with error message.

Does your web server run with visible error message? If it does, comment (add // at start of line):
Code:
header('Content-type: image/gif');
and visit page to view error.

If it does not show error messages, they must be saved in error.log of web server (without commenting that line).

You may also paste:
Code:
error_reporting(E_ALL);
 ini_set('display_errors', 1);
under:
Code:
<?php
to make it show all, even smallest mistakes in code.
 
Would be easier with error message.

Does your web server run with visible error message? If it does, comment (add // at start of line):
Code:
header('Content-type: image/gif');
and visit page to view error.

If it does not show error messages, they must be saved in error.log of web server (without commenting that line).

You may also paste:
Code:
error_reporting(E_ALL);
ini_set('display_errors', 1);
under:
Code:
<?php
to make it show all, even smallest mistakes in code.

Oops 404! That page can’t be found

and i dont have an error.log :(
Post automatically merged:

a year ago I used this site, on a server, and it worked perfectly. now you have this problem.
but I tested another gesior and this one has the same problem.
 
Back
Top