<?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>WillxD &#187; PHP</title>
	<atom:link href="http://willxd.com/category/tutoriales/php/feed/" rel="self" type="application/rss+xml" />
	<link>http://willxd.com</link>
	<description>La magia no existe, la programación sí !</description>
	<lastBuildDate>Tue, 13 Sep 2011 20:39:14 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	
		<item>
		<title>Descargar Imagenes con un Click</title>
		<link>http://willxd.com/descargar-imagenes-con-un-click/</link>
		<comments>http://willxd.com/descargar-imagenes-con-un-click/#comments</comments>
		<pubDate>Sun, 05 Apr 2009 20:43:54 +0000</pubDate>
		<dc:creator>WillxD</dc:creator>
				<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://willxd.com/?p=2155</guid>
		<description><![CDATA[Encontré una manera fácil de descargar imágenes con un solo click usando un pequeño script en PHP. El pequeño script será el siguiente: &#60;?php $enlace = &#34;imagenes/&#34;.$id; header &#40;&#34;Content-Disposition: attachment; filename=&#34;.$id.&#34;\n\n&#34;&#41;; header &#40;&#34;Content-Type: application/octet-stream&#34;&#41;; header &#40;&#34;Content-Length: &#34;.filesize&#40;$enlace&#41;&#41;; readfile&#40;$enlace&#41;; ?&#62; Lo guardaremos con el nombre "desc.php". Algo importante del código es "$enlace = "imagenes/".$id;" que es [...]]]></description>
			<content:encoded><![CDATA[<div class="tut_image"><img src="http://willxd.com/wp-content/uploads/2009/04/descargar-imagenes-con-1click.jpg" alt="descargar-imagenes-con-1click" title="descargar-imagenes-con-1click" width="200" height="200" class="aligncenter size-full wp-image-2157" /></div>
<p>Encontré una manera fácil de descargar imágenes con un solo click <img src='http://willxd.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  usando un pequeño script en PHP.</p>
<p><span id="more-2155"></span></p>
<p>El pequeño script será el siguiente:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
<span style="color: #000088;">$enlace</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;imagenes/&quot;</span><span style="color: #339933;">.</span><span style="color: #000088;">$id</span><span style="color: #339933;">;</span>
<span style="color: #990000;">header</span> <span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Content-Disposition: attachment; filename=&quot;</span><span style="color: #339933;">.</span><span style="color: #000088;">$id</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;<span style="color: #000099; font-weight: bold;">\n</span><span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #990000;">header</span> <span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Content-Type: application/octet-stream&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #990000;">header</span> <span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Content-Length: &quot;</span><span style="color: #339933;">.</span><span style="color: #990000;">filesize</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$enlace</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #990000;">readfile</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$enlace</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></div></div>

<p>Lo guardaremos con el nombre "desc.php".<br />
Algo importante del código es "<strong>$enlace = "imagenes/".$id;</strong>" que es donde estarán guardados nuestras imágenes, en este caso debemos guardar las imágenes en la carpeta "imagenes"</p>
<p>Luego en nuestra página colocamos esto:</p>

<div class="wp_syntax"><div class="code"><pre class="html4strict" style="font-family:monospace;"><span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">a</span> <span style="color: #000066;">href</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;desc.php?id=imagen1.jpg&quot;</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">img</span> <span style="color: #000066;">src</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;imagenes/imagen1.jpg&quot;</span> <span style="color: #000066;">width</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;256&quot;</span> <span style="color: #000066;">height</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;192&quot;</span> &gt;</span>
<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">a</span>&gt;</span></pre></div></div>

<p>Donde imagen1 sería la imagen que podremos descargar con 1 solo click <img src='http://willxd.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>Lo útil de este pequeño script, es que podemos poner la imagen en un tamaño menor y cuando lo descargamos, lo descargaremos en su tamaño real.</p>
<p>Espero les ayude <img src='http://willxd.com/wp-includes/images/smilies/icon_razz.gif' alt=':P' class='wp-smiley' />  !</p>


<p>Related posts:<ol><li><a href='http://willxd.com/marco-decorativo-para-imagenes-con-css/' rel='bookmark' title='Permanent Link: Marco decorativo para imagenes con CSS'>Marco decorativo para imagenes con CSS</a></li>
<li><a href='http://willxd.com/como-crear-un-formulario-elegante-con-css-e-imagenes/' rel='bookmark' title='Permanent Link: Como Crear un Formulario Elegante con CSS e Imágenes'>Como Crear un Formulario Elegante con CSS e Imágenes</a></li>
<li><a href='http://willxd.com/esquinas-redondeadas-con-jquery/' rel='bookmark' title='Permanent Link: Esquinas redondeadas con jQuery'>Esquinas redondeadas con jQuery</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://willxd.com/descargar-imagenes-con-un-click/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
	</channel>
</rss>

