我有这个生成图像的脚本:
parents = Set.new
children = Children.eager_load(:parent).where(condition).all
children.each {|child| parents << child.parent }
现在我要保存该图像。我怎样才能做到这一点?这是我到目前为止所尝试的:
$im = imagecreatetruecolor(110, 34);
$red = imagecolorallocate($im, 245, 245, 245);
imagefill($im, 0, 0, $red);
$text_color = imagecolorallocate($im, 80, 80, 80);
imagestring($im, 8, 15, 9, image, $text_color);
header('Content-Type: image/jpeg');
imagejpeg($im);
出了什么问题?