Jump to content

PHP Image Problems


Lunacy

Recommended Posts

I am in the process of making a RuneScape fansite. I am at the portion of the project where I am making a sig generator, I am relatively new to PHP so I have been using tutorials from around the net. I have the image displaying correctly and everything but I want to echo it out onto a webpage so the user can just copy the provided urls and be fine, my problem is not that though. There is a problem with it displaying wierdly. Refer to the following screenshot:

 

 

http://gyazo.com/40af1f4ade5b4a3f032052c5246c8491.png?1367255661

 

 

My code:

 

 

 

 
$image_link = 'image.png';
$image = imagecreatefrompng($image_link);

$font_colour = imagecolorallocate($image, 0, 0, 0);
$font_size = 3;

$x = array('28', '80', '135', '188', '240');
$y = array('8', '29', '52', '77', '100');

$i = '0';
$a = '0';
foreach($stat as $s_key => $value){
    imagestring($image, $font_size, $x[$a], $y[$i], $value[1], $font_colour);
    $i++;
    if($i == '5'){
        $i = '0';
        $a++;
    }
}

imagestring($image, $font_size, '230', '100', 'Total:'. $overall[1], $font_colour);
imagestring($image, $font_size, '240', '75', '' . $username, $font_colour);
imagepng($image);
imagedestroy($image);
echo '<img src="http://07tools.com/sig.php?username='.$_GET['username'].'&fakeparm=.gif" />';
Link to comment
Share on other sites

 

Remove the last line and put it on the page where you want to display the image (just as with any other image).

 

Put the rest of the image code in sig.php

 

edit; before the imagepng() you need

header("content-type: image/png");

 

Instead of it displaying just the dynamically generated image on that page I would like to display the generated image to my users (who generate the images through form input) automatically on a page. For example: http://www.draynor.net/signatures

Edited by Lunacy
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.