<?php /** * Created by JetBrains PhpStorm. * User: taoqili * Date: 11-12-28 * Time: 上午9:54 * To change this template use File | Settings | File Templates. */ $uri = htmlspecialchars($_POST['content']); //Ajax提交的网址内容中如果包含了&符号,上述函数会将其转成&导致地址解析不对,这里要转回来 $uri = str_replace("&", "&", $uri); getRemoteImage($uri); /** * @param $uri */ function getRemoteImage($uri) { //忽略抓取时间限制 set_time_limit(0); //远程抓取图片配置 $config = array("savePath" => "../../upload/uploadimages/", "fileType" => array(".gif", ".png", ".jpg", ".jpeg", ".bmp"), "fileSize" => 3000); //ue_separate_ue ue用于传递数据分割符号 $imgUrls = explode("ue_separate_ue", $uri); $tmpNames = array(); foreach ($imgUrls as $imgUrl) { //格式验证 $fileType = strtolower(strrchr($imgUrl, '.')); if (!in_array($fileType, $config['fileType'])) { array_push($tmpNames, "error"); continue;
<?php /** * Created by JetBrains PhpStorm. * User: taoqili * Date: 11-12-28 * Time: 上午9:54 * To change this template use File | Settings | File Templates. */ header("Content-Type: text/html; charset=utf-8"); error_reporting(E_ERROR | E_WARNING); //远程抓取图片配置 $config = array("savePath" => "../../../Uploads/img/", "allowFiles" => array(".gif", ".png", ".jpg", ".jpeg", ".bmp"), "maxSize" => 3000); $uri = htmlspecialchars($_POST['upfile']); $uri = str_replace("&", "&", $uri); getRemoteImage($uri, $config); /** * 远程抓取 * @param $uri * @param $config */ function getRemoteImage($uri, $config) { //忽略抓取时间限制 set_time_limit(0); //ue_separate_ue ue用于传递数据分割符号 $imgUrls = explode("ue_separate_ue", $uri); $tmpNames = array(); foreach ($imgUrls as $imgUrl) { //http开头验证 if (strpos($imgUrl, "http") !== 0) {
* Created by JetBrains PhpStorm. * User: taoqili * Date: 11-12-28 * Time: 上午9:54 * To change this template use File | Settings | File Templates. */ header("Content-Type: text/html; charset=utf-8"); error_reporting(E_ERROR | E_WARNING); include "../upyun.class.php"; include "../upyun.config.php"; //远程抓取图片配置 $config = array("savePath" => "upload/", "allowFiles" => array(".gif", ".png", ".jpg", ".jpeg", ".bmp", ".tif", ".webp"), "maxSize" => 20480); $uri = htmlspecialchars($_POST['upfile']); $uri = str_replace("&", "&", $uri); $upyun = new UpYun($img_bucket, $img_username, $img_passwd); getRemoteImage($uri, $config, $upyun); /** * 远程抓取 * @param $uri * @param $config */ function getRemoteImage($uri, $config, $upyun) { //忽略抓取时间限制 set_time_limit(0); //ue_separate_ue ue用于传递数据分割符号 $imgUrls = explode("ue_separate_ue", $uri); $tmpNames = array(); foreach ($imgUrls as $imgUrl) { //http开头验证 if (strpos($imgUrl, "http") !== 0) {