<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>图片处理 &#8211; LPC影子技术分享</title>
	<atom:link href="https://www.mudbest.com/tag/%E5%9B%BE%E7%89%87%E5%A4%84%E7%90%86/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.mudbest.com</link>
	<description>行影不离,忘之却步.</description>
	<lastBuildDate>Mon, 01 Oct 2012 10:00:35 +0000</lastBuildDate>
	<language>zh-Hans</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=7.1.1</generator>
	<item>
		<title>获取远程图片保存至本地函数</title>
		<link>https://www.mudbest.com/%e8%8e%b7%e5%8f%96%e8%bf%9c%e7%a8%8b%e5%9b%be%e7%89%87%e4%bf%9d%e5%ad%98%e8%87%b3%e6%9c%ac%e5%9c%b0%e5%87%bd%e6%95%b0/</link>
		
		<dc:creator><![CDATA[hkshadow]]></dc:creator>
		<pubDate>Thu, 30 Jun 2011 02:14:47 +0000</pubDate>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[图片处理]]></category>
		<guid isPermaLink="false">http://www.mudbest.com/?p=692</guid>

					<description><![CDATA[]]></description>
										<content:encoded><![CDATA[<pre class="brush: php; title: ; notranslate">
&lt;?php
set_time_limit (0);  //避免页面超时
/**
 * 获取远程图片保存到本地function
 * by hkshadow
 * date:2011-06-30 AM:10:30
 * edit:2011-06-30 PM:16:24
 * Enter description here ...
 * @param unknown_type $url
 * @param unknown_type $filename
 */
function SavePicLocal($url, $filename = &quot;&quot;) {
	if ($url == &quot;&quot;) :
		return false;
	endif;
	
	$files = &quot;../../wedding/uploads/vidiopic&quot;;
	$tofile = date ( &quot;Y&quot; );
	$tofilem = date ( &quot;m&quot; );
	$tofiled = date ( &quot;d&quot; );
	
	$dir_name .= $files . &quot;/&quot; . $tofile.&quot;/&quot;;
	if (! file_exists ( $dir_name )) //判断文件夹是否存在
	{
		mkdir ( $dir_name, 0777 );
		@chmod ( $dir_name, 0777 );
	}
	
	$dir_name .= $tofilem.&quot;/&quot;;

	if (! file_exists ( $dir_name )) //判断文件夹是否存在
	{
		mkdir ( $dir_name, 0777 );
		@chmod ( $dir_name, 0777 );
	}
	$dir_name .= $tofiled;

	if (! file_exists ( $dir_name )) //判断文件夹是否存在
	{
		mkdir ( $dir_name, 0777 );
		@chmod ( $dir_name, 0777 );
	}
	
	
	if ($filename == &quot;&quot;) {
		$ext = strrchr ( $url, &quot;.&quot; );
		//   if($ext!=&quot;.gif&quot; &amp;&amp; $ext!=&quot;.jpg&quot;):return false;endif;
		if ($ext != &quot;.gif&quot; &amp;&amp; $ext != &quot;.jpg&quot;) {
			$filename = $dir_name . &quot;/&quot; . date ( &quot;dMYHis&quot; ) . &quot;.png&quot;;
		} else {
			$filename = $dir_name . &quot;/&quot; . date ( &quot;dMYHis&quot; ) . $ext;
		}
	}
	
	ob_start ();
	readfile ( $url );
	$img = ob_get_contents ();
	ob_end_clean ();
	$size = strlen ( $img ); //文件大小
	$fp2 = @fopen ( $filename, &quot;a&quot; );
	fwrite ( $fp2, $img );
	fclose ( $fp2 );
	
	return $filename;
}
?&gt;
</pre>
]]></content:encoded>
					
		
		
			</item>
	</channel>
</rss>
