$v) { $swidthtop[$k] = $swidth * strlen($v); $swidthtopm = ($swidthtopm <= $swidthtop[$k]) ? $swidthtop[$k] : $swidthtopm; } $swidthmid = Array(); $swidthmidm = 0; foreach ($middle as $k => $v) { $swidthmid[$k] = $swidth * strlen($v); $swidthmidm = ($swidthmidm <= $swidthmid[$k]) ? $swidthmid[$k] : $swidthmidm; } $swidthbot = Array(); $swidthbotm = 0; foreach ($bottom as $k => $v) { $swidthbot[$k] = $swidth * strlen($v); $swidthbotm = ($swidthbotm <= $swidthbot[$k]) ? $swidthbot[$k] : $swidthbotm; } $twidth = $newwidth; //width is the width of the cat + the width of the longest phrase + 10 to play with if ($swidthtopm > $swidthmidm) { $sawidth = ($swidthtopm > $swidthbotm) ? $swidthtopm : $swidthbotm; } else { $sawidth = ($swidthmidm > $swidthbotm) ? $swidthmidm : $swidthbotm; } $sawidth += 50; $twidth += $sawidth; //$theight = ($newheight>($sheight)*3+20) ? $newheight : ($sheight)*3+20; $theight = $newheight + 20; $thumb = imagecreatetruecolor($twidth,$theight); imagecopyresampled($thumb, $im, 0, ($theight-$newheight)/2, 0, 0, $newwidth, $newheight, $width, $height); $text_color = imagecolorallocate ($thumb, 245,56,255); #$theight/2-$sheight/2-($sheight+5) $offset = (count($top) == 1)?$sheight+5:10; foreach ($top as $k => $v) { imagestring ($thumb, $font, $newwidth+ ($sawidth-$swidthtop[$k])/2, $offset, $v, $text_color); $offset += $sheight+5; } $offset = $theight/2-($sheight+($sheight+5)*(count($middle)-1))/2; foreach ($middle as $k => $v) { imagestring ($thumb, $font, $newwidth+ ($sawidth-$swidthmid[$k])/2, $offset, $v, $text_color); $offset += $sheight+5; } $offset = $theight-(($sheight+5)*count($bottom)+((count($bottom) == 1)?15:5)); foreach ($bottom as $k => $v) { imagestring ($thumb, $font, $newwidth+ ($sawidth-$swidthbot[$k])/2, $offset, $v, $text_color); $offset += $sheight+5; } header('Content-type: image/png'); #imagejpeg($thumb,'',90); imagepng($thumb); ?>