Jump to content

[SOLVED] Is it possible?


Solar

Recommended Posts

I have a script to import text from a form and insert into a picture.

 

Is it possible to import an image ontop of an image?

 

<?php

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

$user = $_POST['user'];

$user = $_GET['user'];

$im = imagecreatefrompng("banner.png");

$user_width = imagettfbbox(50, 50, "verdana.ttf", $user);

$x_value = (122 - ($user_width[10] + 122));

$color = imagecolorallocate($im, 255, 255, 255);

imagettftext($im, 20, 0, $x_value, 65, $color, "verdana.ttf", $user);

imagepng($im);

imagedestroy($im);

?>

 

What would I go by?

Link to comment
https://forums.phpfreaks.com/topic/152939-solved-is-it-possible/
Share on other sites

Going by the code he posted it's an image created by GD.

Yes it's possible, but your host needs to have GD support enabled, you could create a phpinfo file and check the output to see if it does.

 

Problem with images is that you don't see much when it errors out, try commenting the "header("Content-type: image/png");"

line. That should make errors show up unless your host has disabled error reporting together.

 

I'm guessing if GD is installed/enabled that your problem lies either with the $user getting called for twice where the $_POST is getting absoleted by the $_GET or due to verdana.ttf not being installed on the server.

You may want the look up $_REQUEST if you want to use $_POST whenever $_GET isn't set.

 

PS: Use code tags instead of blockquote for syntax highlighting.

Even with error codes disabled they can be enabled.

error_reporting(E_ALL ^ E_NOTICE);

That will show all errors but not the notices.

 

In order to display the error messages when playing with GD functions comment out the line(s) sending the image header info (as mentioned above) and access the file using the GD functions directly in the browser as calling it from IMG will still hide the errors.

Archived

This topic is now archived and is closed to further replies.

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