Jump to content

[SOLVED] PHP Image problem


BillyBoB

Recommended Posts

I am building a php sig for my website.

I am working to put a font on the text that is displayed.

 

here is the code i have it works but no special text:

<?php
$username = substr($_GET[username],0,20);
if(!$username) {
	$username = "None";
}
header("Content-type: image/jpeg");
$im = ImageCreateFromJPEG("Untitled-2.jpg");
$txt_color = imagecolorallocate($im, 255, 255, 255);
imagestring($im, 2, 65, 3, "$username", $txt_color);
imageJPEG($im);
?>

 

this is the code with a font loaded but it doesnt work:

<?php
$username = substr($_GET[username],0,20);
if(!$username) {
	$username = "None";
}
header("Content-type: image/jpeg");
$im = ImageCreateFromJPEG("Untitled-2.jpg");
$txt_color = imagecolorallocate($im, 255, 255, 255);
$font = imageloadfont("pf_tempesta_five_condensed.ttf");
imagestring($im, $font, 65, 3, "$username", $txt_color);
imageJPEG($im);
?>

 

the working sig is shown at the bottom on my sig.

Link to comment
Share on other sites

image.php

<?php
header("Content-type: image/jpeg");
$im = ImageCreateFromJPEG("Untitled-2.jpg");
$txt_color = imagecolorallocate($im, 255, 255, 255);
$font = imageloadfont("pf_tempesta_five_condensed.ttf");
imagestring($im, $font, 65, 3, "$username", $txt_color);
imageJPEG($im);
?>

 

test.php

<?php

$username = substr($_GET[username],0,20);
if(!$username) {
	$username = "None";
}
echo "<img src='image.php'></img>";
?>

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

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

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

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.