<meta http-equiv= "Content-type" content= "text/html; Charset=utf-8 "/> Ob_start (); Imagejpeg ($temp _img); $imgstr = Ob_get_contents (); $s->write (' image1234 ', $savepath, $IMGSTR); Ob_end_clean (); Imagedestroy ($im); Return "saestor://image1234/". $savepath; }
function Create_guid () {
$charid = Strtoupper (MD5 (Uniqid (Mt_rand (), true));
$hyphen = Chr (45);//"-"
substr ($charid, 0, 8)
. substr ($charid, 8, 4)
. substr ($charid, 12, 4)
. substr ($charid, 16, 4)
;
return $uuid;
}
if ($_server[' request_method ' = = ' POST ') { echo "\ n upload start time:". ". Date (' y-m-d h:i:s '; time ())." \ n "; $destination _folder= "saestor://image1234/updateimg/"; Upload file path need to create storage on Sina cloud $file = $_files["Upfile"]; $filename = $file ["Tmp_name"]; $image _size = getimagesize ($filename); $pinfo =pathinfo ($file ["name"]); $ftype = $pinfo [' extension ']; $imagebig =create_guid (). ".". $ftype; $imagesmall =create_guid (). ".". $ftype; $bucket = "w376161501"; $object = "ionic/imagebig/". $imagebig; try{
if (Move_uploaded_file ($filename, $destination _folder. $imagebig))//parameter is the location and name of the file stream and storage
{
echo "Original image upload success";
}
$path =outputsmallimage ($filename, 225, $imagesmall); } catch (Ossexception $e) { echo $e; } Unlink ($path); Used to delete thumbnails}?></body>
* Sina Cloud on imagegif does not support wrapper, namely Imageif,imagejpeg,imagepan not adapt. Write to Buffer Ob_start () and write to Stor by Saestorage
* Need to apply for storage (free) on Sina Cloud
Another way to refer to Links: http://blog.csdn.net/yangyun_1999/article/details/20377989#comments
Other Sina cloud application files Read and write: http://blog.csdn.net/liuqiyao_01/article/details/8551274 (reference value is relatively large)
Sina Cloud implementation upload thumbnail image