0

in the db table contains information that links to the image.

<P> <IMG Src=\"http://bismute.dothome.co.kr/test1.jpg\"> </P>
<P> <IMG Src=\"http://bismute.dothome.co.kr/test2.jpg\"> </P>

From the board to show thumbnails of each image is.

However, creating a thumbnail showing the existing function as follows:

Is to show only one image.

// Function to create thumbnails
public function ThumbNailImg($Contents) {
    $ThumbImg = stripslashes($Contents);
    preg_match_all ("/<img[^>]*src=[\"']?([^>\"']+)[\"']?[^>]*>/i", $ThumbImg, $ThumbImg);    
    return $ThumbImg[1];
}

// Get part of the image
$ThumbImg = $BBS->ThumbNailImg($res2 [CONTENTS]);

if (count($ThumbImg) > 0) {    
    $ThumbImg = "<img src='".$ThumbImg[0]."' width='200px'>";
    $ThumbImg2 = "<img src='".$ThumbImg[1]."' width='200px'>";
    $ThumbArea = "<td width='200px' style='position:relative'> <a class = 'bbsList' style = 'position: absolute; z-index: 1; top: 0px; clip: rect (0px 190px 110px 0px);'> ". $ThumbImg." </ div> </ a> </ td><td valign='top'> ";
    $ThumbArea2 = "<td width='200px' style='position:relative'> <a class = 'bbsList' style = 'position: absolute; z-index: 1; top: 0px; clip: rect (0px 190px 110px 0px);'> ". $ThumbImg2." </ div> </ a> </ td><td valign='top'> ";
}

Although it is possible to get a thumbnail of test1.jpg, test2.jpg to create a thumbnail of what it is you need to change is wondering.

4

1 回答 1

0

尝试改变这个:

$ThumbImg = $BBS->ThumbNailImg ($res2 [CONTENTS]);

if (count ($ThumbImg)> 0) {

$ThumbImg = "<img src='".$ThumbImg[0]."' width='200px'>";
$ThumbImg2 = "<img src='".$ThumbImg[1]."' width='200px'>";

对此:

$ThumbImgArray = $BBS->ThumbNailImg ($res2 [CONTENTS]);

if (count ($ThumbImgArray) > 0) {

$ThumbImg = "<img src='".$ThumbImgArray[0]."' width='200px'>";
$ThumbImg2 = "<img src='".$ThumbImgArray[1]."' width='200px'>";

请注意,我更改了第一个变量名称$ThumbImg$ThumbImgArray防止在后面的语句中覆盖此变量。

于 2013-09-17T11:09:11.963 回答