<?php
defined('BASEPATH') OR exit('No direct script access allowed');

/**
 * [get_icon_list 获取channel_img所有图片文件名]
 * @return [type] [description]
 */
function get_icon_list()
{

    $dir = opendir(FCPATH.'assets/images/channel_img/');

    $icon_list = array();
    while (($file = readdir($dir)) !== false)
    {
        
        if(preg_match('/^.+\.(gif|png|jpg|jpeg)$/', $file))
        {
            $icon[] = $file;
        }
    }

    closedir($dir);
    return $icon;
}

/**
 * [icon_size 判断图片宽高是否80*80]
 * @param  [type] $icon [description]
 * @return [type]       [description]
 */
function icon_size($icon, $icon_size)
{
    list($width,$height) = getimagesize(FCPATH.'assets/images/channel_img/'.$icon);
    if($width != $icon_size[0] && $height != $icon_size[1])
    {
        return false;
    }
    return true;
}

