Jump to content

Recommended Posts

I have a script called getimage.php

 

I call that script in my html tags like <img src="getimage.php?imageID=100" />

 

However, when I display two on the screen like:

 

<img src="getimage.php?imageID=100" />

<img src="getimage.php?imageID=305" />

 

They both come back all messed up, each time I refresh the page, they are messed up differently.

 

Inside the getimage.php script I am creating an image by combining multiple images together. I then output them with imageGIF.

 

However, for some reason - even if I have two copies of a the script like:

 

<img src="getimage1.php?imageID=100" />

<img src="getimage2.php?imageID=305" />

 

The images come back all messed up...

 

The only case where they come back properly is if all the images I am combining are the same in both scripts, however if I use two copies of getimage.php like above:

 

<img src="getimage1.php?imageID=100" />

<img src="getimage2.php?imageID=305" />

 

Then NO MATTER WHAT they both come back messsed up...

 

AHH please help!

Link to comment
https://forums.phpfreaks.com/topic/89406-gdphp-image-display-bugerror/
Share on other sites

I forgot to mention, here is the script mine is based off:

 

http://www.codewalkers.com/c/a/Miscellaneous/Overlapping-Images-with-GD/1/

 

The only thing different is I combine more than one image in mine... but i've tried combining just two and the error still occurs so thats not relevant.

It sounds like a memory problem and errors in the script when the browser makes two simultaneous requests back to the web server and two instances of getimage.php are created.

 

Add the following line after the first opening <?php tag, execute the code, and then check your web server log for errors -

 

error_reporting(E_ALL);

I checked, there are no errors in the error log... I tried E_ALL also... no errors.

 

Here is what the images are coming back like:

 

xmplesd0.gif

 

Anyone have ideas why this is happening? I even tried saving the images with:

 

imagegif($image, $image_path);

 

And in my $image_path the images are saving, but they are still all messed up...

Ok, I've been breaking the code down trying to find the problem but I have nothing left to remove really.... and the problem still exists:

 

getimage.php =

<?php
//Display image type as gif
header ("Content-type: image/gif");
// Name of image
header('Content-Disposition: attachment; filename="abc"');

if ($_GET['ID']==1){
	$image = imagecreatefromgif("images/characters/base/male1.gif");
} else {
	$image = imagecreatefromgif("images/characters/hair/male1_bluehair.gif");
}

imagegif($image);
imagedestroy($image);

?>

 

On the page where I am using this script I have simply:

 

<img src="getimage.php?ID=1" />

<img src="getimage.php?ID=2" />

 

And the images are returning just like they do above... all messed up!

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.