Jump to content

[SOLVED] New problem with GD and merge two images


Isterklister

Recommended Posts

Hello again,

I have now picked up some code to merge two pictures (with transparency).

<?php

$flag = $_GET['flag'];

/* Attempt to overlay transparent and semi-transparent images */

$width = 800;

$height = 600;

$dst_width = 800;

$dst_height = 600;

 

$bottom_image = imagecreatefrompng("flag-back.png");

$top_image = imagecreatefrompng('$flag');

imagesavealpha($top_image, false);

imagealphablending($top_image, false);

imagecopy($bottom_image, $top_image, 0, 0, 0, 0, $width, $height);

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

$erer = 232;

imagepng($bottom_image);

imageDestroy($bottom_image);

?>

 

I call the sript from another file:

echo "<img src='merge_flag_logo.php?flag=$flag_t[flag]>";

 

The script works fine if I instead of $_GET... just write a picture name instead of $flag.

How can I get the image name with GET and use it in the script?

Thanks

Isterklister

Link to comment
Share on other sites

i would say firstly,

 

$top_image = imagecreatefrompng('$flag');

 

you need quotes on that, not 's... 's kill variables... it is looking for the file by the name of '$flag' not for the one specified in $_GET[flag]...

Link to comment
Share on other sites

The script works fine if I instead of $_GET... just write a picture name instead of $flag.

How can I get the image name with GET and use it in the script?

 

secondly, then i would guess, you have some complications in the file name that is being entered dynamically into the <img> tag... you may want to check for spaces, and whatnot and urlencode/urldecode to avoid that

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.