Recon Posted December 19, 2006 Share Posted December 19, 2006 I'm using phpThumb to make thumbnails of images stored as BLOBs on a database. I have 3 BLOBs per row (img1, img2 & img3) but I can't work out how to display each image using phpThumb.I'm a newbie to PHP and MySQL so I don't really know what I'm doing.config file[code]$PHPTHUMB_CONFIG['mysql_query'] = 'SELECT img1,img2,img3 FROM `products` WHERE (`id` = \''.mysql_escape_string(@$_GET['id']).'\')';$PHPTHUMB_CONFIG['mysql_query'] is blank.$PHPTHUMB_CONFIG['mysql_hostname'] = 'localhost';$PHPTHUMB_CONFIG['mysql_username'] = '*******';$PHPTHUMB_CONFIG['mysql_password'] = '********';$PHPTHUMB_CONFIG['mysql_database'] = '*******';[/code]phpThumb.php[code]if ($phpThumb->config_mysql_query) { if ($cid = @mysql_connect($phpThumb->config_mysql_hostname, $phpThumb->config_mysql_username, $phpThumb->config_mysql_password)) { if (@mysql_select_db($phpThumb->config_mysql_database, $cid)) { if ($result = @mysql_query($phpThumb->config_mysql_query, $cid)) { if ($row = @mysql_fetch_array($result)) { mysql_free_result($result); mysql_close($cid); $phpThumb->setSourceData($row[0]); unset($row); } else { mysql_free_result($result); mysql_close($cid); $phpThumb->ErrorImage('no matching data in database.'); } } else { mysql_close($cid); $phpThumb->ErrorImage('Error in MySQL query: "'.mysql_error($cid).'"'); } } else { mysql_close($cid); $phpThumb->ErrorImage('cannot select MySQL database: "'.mysql_error($cid).'"'); } } else { $phpThumb->ErrorImage('cannot connect to MySQL server'); } unset($_GET['id']);}[/code]How should I set this up to work?web page[code]<img src='phpThumb.php?id=$id&w=100px&h=40px&zc=1' alt='Image'><img src='phpThumb.php?id=$id&w=100px&h=40px&zc=1' alt='Image'><img src='phpThumb.php?id=$id&w=100px&h=40px&zc=1' alt='Image'>[/code] Link to comment https://forums.phpfreaks.com/topic/31191-phpthumb-mysql-displaying-multiple-blobs-from-a-single-row/ Share on other sites More sharing options...
fenway Posted December 19, 2006 Share Posted December 19, 2006 I have no idea how this wrapper class works, but you need to write out the correct header, and then dump the contents. Link to comment https://forums.phpfreaks.com/topic/31191-phpthumb-mysql-displaying-multiple-blobs-from-a-single-row/#findComment-144583 Share on other sites More sharing options...
Recon Posted December 19, 2006 Author Share Posted December 19, 2006 I tried to do this to select img1, img2 and img3:[code]<img src='phpThumb.php?id=$id&type=img1' alt='Image'><img src='phpThumb.php?id=$id&type=img2' alt='Image'><img src='phpThumb.php?id=$id&type=img3' alt='Image'>[/code]With:[code]$PHPTHUMB_CONFIG['mysql_query'] = 'SELECT \''.mysql_escape_string(@$_GET['type']).'\' FROM `products` WHERE (`id` = \''.mysql_escape_string(@$_GET['id']).'\')';[/code]But it doesn't work. :( Link to comment https://forums.phpfreaks.com/topic/31191-phpthumb-mysql-displaying-multiple-blobs-from-a-single-row/#findComment-144714 Share on other sites More sharing options...
fenway Posted December 19, 2006 Share Posted December 19, 2006 Like I said, I don't know what setSourceData() does. Link to comment https://forums.phpfreaks.com/topic/31191-phpthumb-mysql-displaying-multiple-blobs-from-a-single-row/#findComment-144791 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.