草庐IT

imagecolorsforindex

全部标签

php - 什么会导致 imagecolorsforindex() 出现 "color index out of range"错误?

当对一大堆JPG、PNG和GIF文件进行补丁调整时,PHP意外崩溃并显示以下错误消息:imagecolorsforindex()[function.imagecolorsforindex]:Colorindex226outofrange相关代码片段为:protectedfunctionpreserveTransparency($img,$resized,$ftype){if(($ftype==IMAGETYPE_PNG)||($ftype==IMAGETYPE_GIF)){$tidx=imagecolortransparent($img);if($tidx>=0){$transColo