Skip to content
View in the app

A better way to browse. Learn more.

GTAGames.nl - De Nederlandse Grand Theft Auto Community!

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

[GD]Anti-aliasing wegwerken?

Ik heb een GD script die ik gebruik om teksten weer te geven in fonts die niet standaard in Windows zitten, maar deze werkt niet helemaal.

Dit script moet namelijk de witte achtergrond transparant maken (doet hij ook (imagecolortransparent)), maar, omdat de tekst anti-aliasing heeft, krijg ik de kleuren die net niet wit zijn ook in beeld. Dit is niet erg bij een lichte achtergrond, maar ik heb een plaats met een donkere achtergrond, en daar ziet dit er lelijk uit.

Mijn script:

<?php
if ($_GET['size'] == null) {
$size = 20;
} else {
$size = $_GET['size'];
$size += 0;
}
$im = imagecreate(591, ($size + (($size / 4) + 1)));
$tcolor = imagecolorallocate($im, 0, 0, 0);
if ($_GET['color'] != null) {
$tcolor = $_GET['color'];
$tcolor = explode(',', $tcolor);
$tcolor = imagecolorallocate($im, $tcolor[0], $tcolor[1], $tcolor[2]);
}
if ($_GET['text'] == null) {
$text = 'Undefined';
} else {
$text = $_GET['text'];
}
$fontsize = 20;

$transp = imagecolorallocate($im, 255, 255, 255);
$font = 'headertext.ttf';

imagefill($im, 0, 0, $transp);
imagecolortransparent($im, $transp);

imagettftext($im, $size, 0, 0, $size, $tcolor, $font, $text);

header('Content-Type: image/png');
imagepng($im);
imagedestroy($im);
?>

Ik weet het, het is niet zo mooi gescript, maar hij werkt wel.

Edit: Ik heb het al opgelost met een soortgelijk script:

<?php
if ($_GET['size'] == null) {
$size = 20;
} else {
$size = $_GET['size'];
$size += 0;
}
$im = imagecreatetruecolor(591, ($size + (($size / 4) + 1)));
$tcolor = imagecolorallocate($im, 0, 0, 0);
if ($_GET['color'] != null) {
$tcolor = $_GET['color'];
$tcolor = explode(',', $tcolor);
$tcolor = imagecolorallocate($im, $tcolor[0], $tcolor[1], $tcolor[2]);
}
if ($_GET['text'] == null) {
$text = 'Undefined';
} else {
$text = $_GET['text'];
}
$fontsize = 20;

$transp = imagecolorallocatealpha($im, 255, 0, 0, 127);
$font = 'headertext.ttf';

imagesavealpha($im, true);

imagefill($im, 0, 0, $transp);
imagecolortransparent($im, $transp);

imagettftext($im, $size, 0, 0, $size, $tcolor, $font, $text);

header('Content-Type: image/png');
imagepng($im);
imagedestroy($im);
?>

Edited by Donald F. Duck

Featured Replies

No posts to show

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...

Recently Browsing 0

  • No registered users viewing this page.

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.