Jump to content

[SOLVED] imagebmp() troubles


Kairu

Recommended Posts

I guess I'll post the code in it's entirety at the bottom of this post. Basically I'm having trouble with "imagebmp()", while having no trouble with the jpeg, png, or gif equivalents. The only thing I can think of is that the input data is not the proper format? But that should be taken care of when it goes to compile it as a bitmap..... shouldn't it?....

[code]<?php

header('content-type: image/bmp');

mysql_connect('localhost:3306', 'User', 'Pass');

mysql_select_db('gaia_image');

$result = mysql_query('SELECT * FROM data WHERE id = ' . $_GET['id']);

$row = mysql_fetch_array($result);

$sig = $row[1];
$n = $row[2];
$image = array(); $avi = array(); $avi_width = array(); $avi_height = array(); $dest_x = array(); $dest_y = array(); $a = array();

for ($i=0; $i<=$n; $i++)
{
array_push($a, $row[(($i * 3) + 3)]);
}

for ($i=0; $i<=$n-1; $i++)
{
array_push($avi, imagecreatefrompng($a[$i]));
array_push($avi_width, imagesx($avi[$i]));
array_push($avi_height, imagesy($avi[$i]));
}

array_push($image, imagecreatefromstring(file_get_contents($sig)));

if ($row[33] != "1")
{
array_push($image, imagecreatefromstring(file_get_contents($sig)));
}

$size = getimagesize($sig);

for ($i=0; $i<=$n; $i++)
{
$temp = "\$temp = " . $row[(($i * 3) + 4)] . ";";
eval($temp);
array_push($dest_x , $temp );
$temp = "\$temp = " . $row[(($i * 3) + 5)] . ";";
eval($temp);
array_push($dest_y , $temp );
}

for ($i=0; $i<=$n-1; $i++)
{
imagecopy($image[0], $avi[$i], $dest_x[$i] , $dest_y[$i], 0, 0, $avi_width[$i], $avi_height[$i]);
imagedestroy($avi[$i]);
}

if ($row[33] != "1")
{
imagecopy($image[0], $image[1], 0, 0, 0, 0, $size[0], $size[1]);
imagedestroy($image[1]);
}

imagebmp($image[0]);
imagedestroy($image[0]);

?>[/code]
Link to comment
https://forums.phpfreaks.com/topic/31665-solved-imagebmp-troubles/
Share on other sites

well he obviously has gd installed, since he said it works for the other image types.

if i had to take a guess, the info in your db is off or corrupt somehow, and maybe imagewbmp isn't as forgiving as the other functions.  I really can't begin to debug it without having access to the data etc..

off topic: i don't really understand why you are doing this:
[code]
$temp = "\$temp = " . $row[(($i * 3) + 4)] . ";";
eval($temp);
[/code]
why can't you just do this in the first place:
[code]
$temp = $row[(($i * 3) + 4)];
[/code]
[quote author=Crayon Violent link=topic=119711.msg490746#msg490746 date=1166901356]
i don't really understand why you are doing this:
[code]
$temp = "\$temp = " . $row[(($i * 3) + 4)] . ";";
eval($temp);
[/code]
why can't you just do this in the first place:
[code]
$temp = $row[(($i * 3) + 4)];
[/code]
[/quote]
Quite simple when you look at the data on the database. Some of the cells are formulas instead of numeric values, so placing it in a variable would not return a coordinate. And if the cell contains only numerical data, it still works.

@AndyB: Ah! Your correct! Well then.... I guess I can remove bitmap files from the mix.... Thank you!

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.