Mira he hecho esto pero nada de nada:
Código PHP:
.....
if(mysql_num_rows($result) != 0){
$cant = "SELECT COUNT(*) AS cantidad FROM jcgrm_tapices WHERE (idcat=".$categoria.") AND (activa<>0)";
$cantres = mysql_query($cant) or die(mysql_error());
$res = mysql_fetch_array($cantres);
$row = mysql_fetch_array($result);
while($row){
echo "<tr>";
$int = 0;
do {
// Creamos los thumbnails
$image = imagecreatefromjpeg("images/tapices/".$row['imagen']."");
$img_w = imagesx($image);
$img_h = imagesy($image);
$new_img_w = 168;
$new_img_h = 126;
$new_img_source = imagecreate($new_img_w,$new_img_h);
imagecopyresized($new_img_source, $image, 0, 0, 0, 0, $new_img_w, $new_img_h,$img_w, $img_h);
header("Content-type: image/jpeg");
$imagen = imagejpeg($new_img_source,"");
echo "<td><img src='".$imagen."'></td>";
$int++;
} while(($row = mysql_fetch_array($result)) && ($int < $columnas));
echo "</tr>";
......
Salu2
PD: No está todo el código solo un pedazo del mismo