function getPersonalImageUrl($personal_info, $type = '') { $ext_array = array('list', 'tiny'); $personal_image_array = array(); $personal_image_list = explode(',', $personal_info['commend_image']); if (!empty($personal_image_list)) { if (is_array($personal_image_list)) { foreach ($personal_image_list as $value) { if (!empty($type) && in_array($type, $ext_array)) { $file_name = explode(".", $value); $ext = end($file_name); $value .= '_' . $type . '.' . $ext; } $personal_image_array[] = MICROSHOP_IMG_URL . DS . ATTACH_MICROSHOP . DS . $personal_info['commend_member_id'] . DS . $value; } } else { if (!empty($type) && in_array($type, $ext_array)) { $file_name = explode(".", $personal_info['commend_image']); $ext = end($file_name); $personal_info['commend_image'] .= '_' . $type . '.' . $ext; } $personal_image_array[] = MICROSHOP_IMG_URL . DS . ATTACH_MICROSHOP . DS . $personal_info['commend_member_id'] . DS . $personal_info['commend_image']; } } else { $personal_image_array[] = getMicroshopDefaultImage(); } return $personal_image_array; }
/** * 获取微商城个人秀图片地址 */ function getMicroshopPersonalImageUrl($personal_info, $type = '') { $ext_array = array('list', 'tiny'); $personal_image_array = array(); $personal_image_list = explode(',', $personal_info['commend_image']); if (!empty($personal_image_list)) { foreach ($personal_image_list as $value) { if (!empty($type) && in_array($type, $ext_array)) { $file_name = str_replace('.', '_' . $type . '.', $value); } else { $file_name = $value; } $file_path = $personal_info['commend_member_id'] . DS . $file_name; if (is_file(BASE_UPLOAD_PATH . DS . ATTACH_MICROSHOP . DS . $file_path)) { $personal_image_array[] = UPLOAD_SITE_URL . DS . ATTACH_MICROSHOP . DS . $file_path; } else { $personal_image_array[] = getMicroshopDefaultImage(); } } } else { $personal_image_array[] = getMicroshopDefaultImage(); } return $personal_image_array; }