public static function addThumbTaskList($image) { $thumbTaskList = CacheUtils::getDzPluginCache('thumb_task_list', true); $maxCount = WebUtils::getDzPluginAppbymeAppConfig('image_thumb_task_max_length'); $maxCount === false && ($maxCount = 20); if ($maxCount == 0 || $maxCount > count($thumbTaskList)) { $thumbTaskList[md5($image)] = $image; } CacheUtils::setDzPluginCache('thumb_task_list', $thumbTaskList, false); }
public function actionMakeThumb($count = 10) { $thumbTaskList = CacheUtils::getDzPluginCache('thumb_task_list'); $thumbTaskList === false && ($thumbTaskList = array()); $count <= 0 && ($count = count($thumbTaskList)); $count = min(count($thumbTaskList), $count); $i = 0; foreach ($thumbTaskList as $key => $thumb) { if ($i >= $count) { break; } ImageUtils::getThumbImageEx($thumb, 20, false, false, true); $i++; } echo WebUtils::jsonEncode($thumbTaskList); array_splice($thumbTaskList, 0, $count); CacheUtils::setDzPluginCache('thumb_task_list', $thumbTaskList); }