document.write("<div class=\"pastie\">\n");
document.write("  <link href=\"http://pastie.org/stylesheets/embed.css\" media=\"screen\" rel=\"stylesheet\" type=\"text/css\" />\n");
document.write("  <link href=\"http://pastie.org/stylesheets/clean.css\" media=\"screen\" rel=\"stylesheet\" type=\"text/css\" />\n");
document.write("  \n");
document.write("\n");
document.write("  \n");
document.write("  \n");
document.write("\n");
document.write("\n");
document.write("\n");
document.write("\n");
document.write("\n");
document.write("\n");
document.write("\n");
document.write("	\n");
document.write("	<div class=\"allcode\">\n");
document.write("		<table cellpadding=\"0\" cellspacing=\"0\" border=\"0\">\n");
document.write("		<tr>\n");
document.write("			<td>\n");
document.write("				\n");
document.write("				<pre class=\"textmate-source-numbers\">1\n");
document.write("2\n");
document.write("3\n");
document.write("4\n");
document.write("5\n");
document.write("6\n");
document.write("7\n");
document.write("8\n");
document.write("9\n");
document.write("10\n");
document.write("11\n");
document.write("12\n");
document.write("13\n");
document.write("14\n");
document.write("15\n");
document.write("16\n");
document.write("17\n");
document.write("18\n");
document.write("19\n");
document.write("20\n");
document.write("21\n");
document.write("22\n");
document.write("23\n");
document.write("24\n");
document.write("25\n");
document.write("26\n");
document.write("27\n");
document.write("28\n");
document.write("29\n");
document.write("30\n");
document.write("31\n");
document.write("32\n");
document.write("33\n");
document.write("34\n");
document.write("35\n");
document.write("36\n");
document.write("37\n");
document.write("38\n");
document.write("39\n");
document.write("40\n");
document.write("41\n");
document.write("42\n");
document.write("43\n");
document.write("44\n");
document.write("45\n");
document.write("46\n");
document.write("47\n");
document.write("48\n");
document.write("49\n");
document.write("50\n");
document.write("51\n");
document.write("52\n");
document.write("53\n");
document.write("54\n");
document.write("55\n");
document.write("56\n");
document.write("57\n");
document.write("58\n");
document.write("59\n");
document.write("60\n");
document.write("61\n");
document.write("62\n");
document.write("63\n");
document.write("64\n");
document.write("65\n");
document.write("66\n");
document.write("67\n");
document.write("68\n");
document.write("69\n");
document.write("70\n");
document.write("<\/pre>\n");
document.write("			<\/td>\n");
document.write("		<td>\n");
document.write("		<pre class=\"textmate-source\"><pre class=\"sunburst\"><span class=\'source source_php source_php_embedded source_php_embedded_block source_php_embedded_block_html\'>&lt;?\n");
document.write("	<span class=\'support support_function support_function_builtin_functions support_function_builtin_functions_php\'>error_reporting<\/span>(<span class=\'constant constant_numeric constant_numeric_php\'>0<\/span>);\n");
document.write("	<span class=\'support support_function support_function_builtin_functions support_function_builtin_functions_php\'>define<\/span>(<span class=\'string string_quoted string_quoted_single string_quoted_single_php\'>\'<span class=\'meta meta_string-contents meta_string-contents_quoted meta_string-contents_quoted_single meta_string-contents_quoted_single_php\'>root_path<\/span>\'<\/span>, <span class=\'support support_function support_function_file support_function_file_php\'>realpath<\/span>(<span class=\'support support_function support_function_string support_function_string_php\'>dirname<\/span>(<span class=\'constant constant_language constant_language_php\'>__FILE__<\/span>))<span class=\'keyword keyword_operator keyword_operator_string keyword_operator_string_php\'>.<\/span><span class=\'string string_quoted string_quoted_double string_quoted_double_php\'>&quot;<span class=\'meta meta_string-contents meta_string-contents_quoted meta_string-contents_quoted_double meta_string-contents_quoted_double_php\'>/<\/span>&quot;<\/span>);\n");
document.write("\n");
document.write("	<span class=\'variable variable_other variable_other_php\'>$url<\/span> <span class=\'keyword keyword_operator keyword_operator_assignment keyword_operator_assignment_php\'>=<\/span> <span class=\'variable variable_other variable_other_global variable_other_global_php\'>$_GET<\/span>[<span class=\'string string_quoted string_quoted_double string_quoted_double_php\'>&quot;<span class=\'meta meta_string-contents meta_string-contents_quoted meta_string-contents_quoted_double meta_string-contents_quoted_double_php\'>url<\/span>&quot;<\/span>];\n");
document.write("	<span class=\'variable variable_other variable_other_php\'>$UrlHash<\/span> <span class=\'keyword keyword_operator keyword_operator_assignment keyword_operator_assignment_php\'>=<\/span> <span class=\'support support_function support_function_hash_md support_function_hash_md_php\'>md5<\/span>(<span class=\'variable variable_other variable_other_php\'>$url<\/span>);\n");
document.write("	<span class=\'variable variable_other variable_other_php\'>$CachedThumb<\/span> <span class=\'keyword keyword_operator keyword_operator_assignment keyword_operator_assignment_php\'>=<\/span> <span class=\'constant constant_other constant_other_php\'>root_path<\/span><span class=\'keyword keyword_operator keyword_operator_string keyword_operator_string_php\'>.<\/span><span class=\'string string_quoted string_quoted_single string_quoted_single_php\'>\'<span class=\'meta meta_string-contents meta_string-contents_quoted meta_string-contents_quoted_single meta_string-contents_quoted_single_php\'>thumbs/<\/span>\'<\/span><span class=\'keyword keyword_operator keyword_operator_string keyword_operator_string_php\'>.<\/span><span class=\'variable variable_other variable_other_php\'>$UrlHash<\/span><span class=\'keyword keyword_operator keyword_operator_string keyword_operator_string_php\'>.<\/span><span class=\'string string_quoted string_quoted_single string_quoted_single_php\'>\'<span class=\'meta meta_string-contents meta_string-contents_quoted meta_string-contents_quoted_single meta_string-contents_quoted_single_php\'>.jpg<\/span>\'<\/span>;\n");
document.write("	<span class=\'variable variable_other variable_other_php\'>$CachedUrl<\/span> <span class=\'keyword keyword_operator keyword_operator_assignment keyword_operator_assignment_php\'>=<\/span> <span class=\'string string_quoted string_quoted_double string_quoted_double_php\'>&quot;<span class=\'meta meta_string-contents meta_string-contents_quoted meta_string-contents_quoted_double meta_string-contents_quoted_double_php\'>http://thumbs.mysite.com/thumbs/<\/span>&quot;<\/span>;\n");
document.write("	<span class=\'variable variable_other variable_other_php\'>$ThumbSvcUrl<\/span> <span class=\'keyword keyword_operator keyword_operator_assignment keyword_operator_assignment_php\'>=<\/span> <span class=\'string string_quoted string_quoted_double string_quoted_double_php\'>&quot;<span class=\'meta meta_string-contents meta_string-contents_quoted meta_string-contents_quoted_double meta_string-contents_quoted_double_php\'>http://open.thumbshots.org/image.pxf?url=<\/span>&quot;<\/span>;\n");
document.write("\n");
document.write("	<span class=\'keyword keyword_control keyword_control_php\'>if<\/span> (<span class=\'keyword keyword_operator keyword_operator_logical keyword_operator_logical_php\'>!<\/span><span class=\'variable variable_other variable_other_php\'>$url<\/span>)\n");
document.write("	{\n");
document.write("		<span class=\'support support_function support_function_head support_function_head_php\'>header<\/span>(<span class=\'string string_quoted string_quoted_double string_quoted_double_php\'>&quot;<span class=\'meta meta_string-contents meta_string-contents_quoted meta_string-contents_quoted_double meta_string-contents_quoted_double_php\'>Location: <\/span>&quot;<\/span><span class=\'keyword keyword_operator keyword_operator_string keyword_operator_string_php\'>.<\/span><span class=\'variable variable_other variable_other_php\'>$ThumbSvcUrl<\/span><span class=\'keyword keyword_operator keyword_operator_string keyword_operator_string_php\'>.<\/span><span class=\'string string_quoted string_quoted_double string_quoted_double_php\'>&quot;<span class=\'meta meta_string-contents meta_string-contents_quoted meta_string-contents_quoted_double meta_string-contents_quoted_double_php\'>google.com<\/span>&quot;<\/span>);\n");
document.write("		<span class=\'keyword keyword_control keyword_control_php\'>exit<\/span>();\n");
document.write("	}\n");
document.write("\n");
document.write("	<span class=\'variable variable_other variable_other_php\'>$stat<\/span> <span class=\'keyword keyword_operator keyword_operator_assignment keyword_operator_assignment_php\'>=<\/span> <span class=\'support support_function support_function_filestat support_function_filestat_php\'>stat<\/span>(<span class=\'variable variable_other variable_other_php\'>$CachedThumb<\/span>);\n");
document.write("	<span class=\'variable variable_other variable_other_php\'>$def<\/span> <span class=\'keyword keyword_operator keyword_operator_assignment keyword_operator_assignment_php\'>=<\/span> <span class=\'support support_function support_function_php_date support_function_php_date_php\'>time<\/span>()<span class=\'keyword keyword_operator keyword_operator_arithmetic keyword_operator_arithmetic_php\'>-<\/span><span class=\'variable variable_other variable_other_php\'>$stat<\/span>[<span class=\'string string_quoted string_quoted_double string_quoted_double_php\'>&quot;<span class=\'meta meta_string-contents meta_string-contents_quoted meta_string-contents_quoted_double meta_string-contents_quoted_double_php\'>mtime<\/span>&quot;<\/span>];\n");
document.write("\n");
document.write("	<span class=\'keyword keyword_control keyword_control_php\'>if<\/span> (<span class=\'support support_function support_function_filestat support_function_filestat_php\'>file_exists<\/span>(<span class=\'variable variable_other variable_other_php\'>$CachedThumb<\/span>) <span class=\'keyword keyword_operator keyword_operator_logical keyword_operator_logical_php\'>&amp;&amp;<\/span> (<span class=\'variable variable_other variable_other_php\'>$def<\/span> <span class=\'keyword keyword_operator keyword_operator_comparison keyword_operator_comparison_php\'>&lt;<\/span> <span class=\'constant constant_numeric constant_numeric_php\'>7776000<\/span>)) <span class=\'comment comment_line comment_line_double-slash comment_line_double-slash_php\'>//60*60*24*90<\/span>\n");
document.write("	{\n");
document.write("		<span class=\'support support_function support_function_head support_function_head_php\'>header<\/span>(<span class=\'string string_quoted string_quoted_double string_quoted_double_php\'>&quot;<span class=\'meta meta_string-contents meta_string-contents_quoted meta_string-contents_quoted_double meta_string-contents_quoted_double_php\'>Location: <\/span>&quot;<\/span><span class=\'keyword keyword_operator keyword_operator_string keyword_operator_string_php\'>.<\/span><span class=\'variable variable_other variable_other_php\'>$CachedUrl<\/span><span class=\'keyword keyword_operator keyword_operator_string keyword_operator_string_php\'>.<\/span><span class=\'variable variable_other variable_other_php\'>$UrlHash<\/span><span class=\'keyword keyword_operator keyword_operator_string keyword_operator_string_php\'>.<\/span><span class=\'string string_quoted string_quoted_double string_quoted_double_php\'>&quot;<span class=\'meta meta_string-contents meta_string-contents_quoted meta_string-contents_quoted_double meta_string-contents_quoted_double_php\'>.jpg<\/span>&quot;<\/span>);\n");
document.write("		<span class=\'keyword keyword_control keyword_control_php\'>exit<\/span>();\n");
document.write("	}\n");
document.write("	<span class=\'keyword keyword_control keyword_control_php\'>else<\/span>\n");
document.write("	{\n");
document.write("		<span class=\'variable variable_other variable_other_php\'>$Data<\/span> <span class=\'keyword keyword_operator keyword_operator_assignment keyword_operator_assignment_php\'>=<\/span> <span class=\'meta meta_function-call meta_function-call_php\'>read_content<\/span>(<span class=\'variable variable_other variable_other_php\'>$ThumbSvcUrl<\/span><span class=\'keyword keyword_operator keyword_operator_string keyword_operator_string_php\'>.<\/span><span class=\'variable variable_other variable_other_php\'>$url<\/span>);\n");
document.write("		<span class=\'variable variable_other variable_other_php\'>$DataLen<\/span> <span class=\'keyword keyword_operator keyword_operator_assignment keyword_operator_assignment_php\'>=<\/span> <span class=\'support support_function support_function_builtin_functions support_function_builtin_functions_php\'>strlen<\/span>(<span class=\'variable variable_other variable_other_php\'>$Data<\/span>);\n");
document.write("	\n");
document.write("		<span class=\'comment comment_block comment_block_php\'>/*<\/span>\n");
document.write("<span class=\"Comment\">		$DataLen:<\/span>\n");
document.write("<span class=\"Comment\">		0		- no data<\/span>\n");
document.write("<span class=\"Comment\">		2006	- preparing thumb by svc<\/span>\n");
document.write("<span class=\"Comment\">		160		- 404 ???<\/span>\n");
document.write("<span class=\"Comment\">		*/<\/span>\n");
document.write("				\n");
document.write("		<span class=\'keyword keyword_control keyword_control_php\'>if<\/span> (<span class=\'variable variable_other variable_other_php\'>$DataLen<\/span> <span class=\'keyword keyword_operator keyword_operator_logical keyword_operator_logical_php\'>!<\/span><span class=\'keyword keyword_operator keyword_operator_assignment keyword_operator_assignment_php\'>=<\/span> <span class=\'constant constant_numeric constant_numeric_php\'>0<\/span> <span class=\'keyword keyword_operator keyword_operator_logical keyword_operator_logical_php\'>&amp;&amp;<\/span> <span class=\'variable variable_other variable_other_php\'>$DataLen<\/span> <span class=\'keyword keyword_operator keyword_operator_logical keyword_operator_logical_php\'>!<\/span><span class=\'keyword keyword_operator keyword_operator_assignment keyword_operator_assignment_php\'>=<\/span> <span class=\'constant constant_numeric constant_numeric_php\'>2006<\/span> <span class=\'keyword keyword_operator keyword_operator_logical keyword_operator_logical_php\'>&amp;&amp;<\/span> <span class=\'variable variable_other variable_other_php\'>$DataLen<\/span> <span class=\'keyword keyword_operator keyword_operator_logical keyword_operator_logical_php\'>!<\/span><span class=\'keyword keyword_operator keyword_operator_assignment keyword_operator_assignment_php\'>=<\/span> <span class=\'constant constant_numeric constant_numeric_php\'>160<\/span>)\n");
document.write("		{\n");
document.write("			<span class=\'keyword keyword_control keyword_control_php\'>if<\/span> (<span class=\'meta meta_function-call meta_function-call_php\'>write_data<\/span>(<span class=\'variable variable_other variable_other_php\'>$CachedThumb<\/span>, <span class=\'variable variable_other variable_other_php\'>$Data<\/span>))\n");
document.write("			{\n");
document.write("				<span class=\'support support_function support_function_head support_function_head_php\'>header<\/span>(<span class=\'string string_quoted string_quoted_double string_quoted_double_php\'>&quot;<span class=\'meta meta_string-contents meta_string-contents_quoted meta_string-contents_quoted_double meta_string-contents_quoted_double_php\'>Location: <\/span>&quot;<\/span><span class=\'keyword keyword_operator keyword_operator_string keyword_operator_string_php\'>.<\/span><span class=\'variable variable_other variable_other_php\'>$CachedUrl<\/span><span class=\'keyword keyword_operator keyword_operator_string keyword_operator_string_php\'>.<\/span><span class=\'variable variable_other variable_other_php\'>$UrlHash<\/span><span class=\'keyword keyword_operator keyword_operator_string keyword_operator_string_php\'>.<\/span><span class=\'string string_quoted string_quoted_double string_quoted_double_php\'>&quot;<span class=\'meta meta_string-contents meta_string-contents_quoted meta_string-contents_quoted_double meta_string-contents_quoted_double_php\'>.jpg<\/span>&quot;<\/span>);\n");
document.write("				<span class=\'keyword keyword_control keyword_control_php\'>exit<\/span>();\n");
document.write("			}\n");
document.write("		}\n");
document.write("		<span class=\'support support_function support_function_head support_function_head_php\'>header<\/span>(<span class=\'string string_quoted string_quoted_double string_quoted_double_php\'>&quot;<span class=\'meta meta_string-contents meta_string-contents_quoted meta_string-contents_quoted_double meta_string-contents_quoted_double_php\'>Location: <\/span>&quot;<\/span><span class=\'keyword keyword_operator keyword_operator_string keyword_operator_string_php\'>.<\/span><span class=\'variable variable_other variable_other_php\'>$ThumbSvcUrl<\/span><span class=\'keyword keyword_operator keyword_operator_string keyword_operator_string_php\'>.<\/span><span class=\'variable variable_other variable_other_php\'>$url<\/span>);\n");
document.write("		<span class=\'keyword keyword_control keyword_control_php\'>exit<\/span>();\n");
document.write("	}\n");
document.write("	\n");
document.write("	\n");
document.write("<span class=\'meta meta_function meta_function_php\'><span class=\'storage storage_type storage_type_function storage_type_function_php\'>function<\/span> <span class=\'entity entity_name entity_name_function entity_name_function_php\'>read_content<\/span>(<span class=\'meta meta_function meta_function_arguments meta_function_arguments_php\'><span class=\'meta meta_function meta_function_argument meta_function_argument_no-default meta_function_argument_no-default_php\'><span class=\'variable variable_other variable_other_php\'>$url<\/span><\/span><\/span>)<\/span>\n");
document.write("{\n");
document.write("	<span class=\'keyword keyword_control keyword_control_php\'>if<\/span> (<span class=\'keyword keyword_operator keyword_operator_error-control keyword_operator_error-control_php\'>@<\/span><span class=\'variable variable_other variable_other_php\'>$fp<\/span> <span class=\'keyword keyword_operator keyword_operator_assignment keyword_operator_assignment_php\'>=<\/span> <span class=\'support support_function support_function_file support_function_file_php\'>fopen<\/span>(<span class=\'variable variable_other variable_other_php\'>$url<\/span>,<span class=\'string string_quoted string_quoted_single string_quoted_single_php\'>\'<span class=\'meta meta_string-contents meta_string-contents_quoted meta_string-contents_quoted_single meta_string-contents_quoted_single_php\'>r<\/span>\'<\/span>))\n");
document.write("	{\n");
document.write("		<span class=\'keyword keyword_control keyword_control_php\'>while<\/span>(<span class=\'keyword keyword_operator keyword_operator_logical keyword_operator_logical_php\'>!<\/span><span class=\'support support_function support_function_file support_function_file_php\'>feof<\/span>(<span class=\'variable variable_other variable_other_php\'>$fp<\/span>)) {\n");
document.write("			<span class=\'variable variable_other variable_other_php\'>$data<\/span> <span class=\'keyword keyword_operator keyword_operator_assignment keyword_operator_assignment_php\'>=<\/span> <span class=\'variable variable_other variable_other_php\'>$data<\/span> <span class=\'keyword keyword_operator keyword_operator_string keyword_operator_string_php\'>.<\/span> <span class=\'support support_function support_function_file support_function_file_php\'>fread<\/span>(<span class=\'variable variable_other variable_other_php\'>$fp<\/span>, <span class=\'constant constant_numeric constant_numeric_php\'>1024<\/span>);\n");
document.write("		}\n");
document.write("		<span class=\'support support_function support_function_file support_function_file_php\'>fclose<\/span>(<span class=\'variable variable_other variable_other_php\'>$fp<\/span>);\n");
document.write("	}\n");
document.write("	<span class=\'keyword keyword_control keyword_control_php\'>return<\/span> <span class=\'variable variable_other variable_other_php\'>$data<\/span>;\n");
document.write("}	\n");
document.write("\n");
document.write("<span class=\'meta meta_function meta_function_php\'><span class=\'storage storage_type storage_type_function storage_type_function_php\'>function<\/span> <span class=\'entity entity_name entity_name_function entity_name_function_php\'>write_data<\/span>(<span class=\'meta meta_function meta_function_arguments meta_function_arguments_php\'><span class=\'meta meta_function meta_function_argument meta_function_argument_no-default meta_function_argument_no-default_php\'><span class=\'variable variable_other variable_other_php\'>$CacheFile<\/span><\/span>,<span class=\'meta meta_function meta_function_argument meta_function_argument_no-default meta_function_argument_no-default_php\'> <span class=\'variable variable_other variable_other_php\'>$Data<\/span><\/span><\/span>)<\/span>\n");
document.write("{\n");
document.write("	<span class=\'keyword keyword_control keyword_control_php\'>if<\/span> (<span class=\'keyword keyword_operator keyword_operator_error-control keyword_operator_error-control_php\'>@<\/span><span class=\'variable variable_other variable_other_php\'>$fp<\/span> <span class=\'keyword keyword_operator keyword_operator_assignment keyword_operator_assignment_php\'>=<\/span> <span class=\'support support_function support_function_file support_function_file_php\'>fopen<\/span>(<span class=\'variable variable_other variable_other_php\'>$CacheFile<\/span>,<span class=\'string string_quoted string_quoted_single string_quoted_single_php\'>\'<span class=\'meta meta_string-contents meta_string-contents_quoted meta_string-contents_quoted_single meta_string-contents_quoted_single_php\'>w<\/span>\'<\/span>))\n");
document.write("	{\n");
document.write("		<span class=\'variable variable_other variable_other_php\'>$result<\/span> <span class=\'keyword keyword_operator keyword_operator_assignment keyword_operator_assignment_php\'>=<\/span> <span class=\'support support_function support_function_file support_function_file_php\'>fwrite<\/span>(<span class=\'variable variable_other variable_other_php\'>$fp<\/span>, <span class=\'variable variable_other variable_other_php\'>$Data<\/span>);\n");
document.write("		<span class=\'support support_function support_function_file support_function_file_php\'>fclose<\/span>(<span class=\'variable variable_other variable_other_php\'>$fp<\/span>);\n");
document.write("	}\n");
document.write("	<span class=\'keyword keyword_control keyword_control_php\'>return<\/span> <span class=\'variable variable_other variable_other_php\'>$result<\/span>;\n");
document.write("}\n");
document.write("<\/pre><\/pre>\n");
document.write("		<\/td>\n");
document.write("		<\/tr>\n");
document.write("		<\/table>\n");
document.write("	\n");
document.write("	<\/div>\n");
document.write("\n");
document.write("\n");
document.write("  \n");
document.write("  \n");
document.write("  <div class=\"credit\">\n");
document.write("    <div class=\"buttons\">\n");
document.write("      <a href=\"http://pastie.org/pastes/510977.txt\">\n");
document.write("      <img src=\"http://pastie.org/images/view.png\" height=\"20\" width=\"67\" /><\/a>\n");
document.write("    <\/div>\n");
document.write("  \n");
document.write("    <a href=\"http://pastie.org/510977\">Pastie #510977<\/a> linked directly from <a href=\"http://pastie.org/\">Pastie<\/a>.\n");
document.write("  <\/div><\/div>");

