Kairu Posted December 22, 2006 Share Posted December 22, 2006 Alright... Just spent a few hours trying to figure this out.... Have a headache and decided perhaps someone with a clear mind could look through the code to see if it makes sense.... After all, two heads are better then one.This is the code in its entirety (Changed the pass and user name of course):[code]<?phpheader('content-type: image/jpeg');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 = 1;$avi = array(); $avi_width = array(); $avi_height = array(); $dest_x = array(); $dest_y = array(); $a = array();for ($i=2; $i<=($n * 3) + 3; $i+3){array_push($a, $row[$i]);}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]));}$image = imagecreatetruecolor($avi_width, $avi_height);if (strpos($sig, '.jpg') !== FALSE) {$image = imagecreatefromjpeg($sig);}elseif (strpos($sig, '.png') !== FALSE) {$image = imagecreatefrompng($sig);}elseif (strpos($sig, '.gif') !== FALSE) {$image = imagecreatefromgif($sig);}elseif (strpos($sig, '.bmp') !== FALSE) {$image = imagecreatefromwbmp($sig);}else {$image = imagecreatefromstring($sig);}$size = getimagesize($sig);for ($i=4; $i<=($n * 3) + 3; $i+3){$temp = "\$temp = " . $row[$i] . ";";eval($temp);array_push($dest_x , $temp );$temp = "\$temp = " . $row[$i + 1] . ";";eval($temp);array_push($dest_y , $temp );}for ($i=0; $i<=$n-1; $i++){imagecopy($image, $avi[$i], $dest_x[$i] , $dest_y[$i], 0, 0, $avi_width[$i], $avi_height[$i]);imagedestroy($avi[$i]);}imagejpeg($image);imagedestroy($image);?>[/code]I only have one row in the table at the moment, I'm trying to get it to work before I add more.I am providing a [url=http://thedarkrealm.no-ip.org/data.csv]link[/url] to a CSV with the table export. I believe it can be viewed in Excel. (If it does not work the first time, try again. My service is being a bit buggy.[i]Any[/i] help would be appreciated.~Kairu~ Link to comment https://forums.phpfreaks.com/topic/31543-solved-php-image-linking-to-database-troubles/ Share on other sites More sharing options...
Kairu Posted December 22, 2006 Author Share Posted December 22, 2006 Edited the code. The coordinates weren't coming from the database, but it still does not work.... Link to comment https://forums.phpfreaks.com/topic/31543-solved-php-image-linking-to-database-troubles/#findComment-146174 Share on other sites More sharing options...
Kairu Posted December 22, 2006 Author Share Posted December 22, 2006 I got it myself! Took such a long time... and I really have no clue what was wrong with it.... Link to comment https://forums.phpfreaks.com/topic/31543-solved-php-image-linking-to-database-troubles/#findComment-146254 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.