<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	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/"
		>
<channel>
	<title>Comments on: An Example Rich Text Editor Image Upload with PHP</title>
	<atom:link href="http://allmybrain.com/2007/12/21/an-example-rich-text-editor-image-upload-with-php/feed/" rel="self" type="application/rss+xml" />
	<link>http://allmybrain.com/2007/12/21/an-example-rich-text-editor-image-upload-with-php/</link>
	<description>Where stuff from my brain lands</description>
	<lastBuildDate>Tue, 07 Feb 2012 16:14:05 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
	<item>
		<title>By: beingaquatic</title>
		<link>http://allmybrain.com/2007/12/21/an-example-rich-text-editor-image-upload-with-php/comment-page-2/#comment-1211</link>
		<dc:creator>beingaquatic</dc:creator>
		<pubDate>Mon, 21 Nov 2011 15:17:02 +0000</pubDate>
		<guid isPermaLink="false">http://allmybrain.com/2007/12/21/an-example-rich-text-editor-image-upload-with-php/#comment-1211</guid>
		<description>if (isset($_FILES[&#039;image&#039;][&#039;tmp_name&#039;])) {
 // open the file
 $img = $_FILES[&#039;image&#039;][&#039;tmp_name&#039;];
 $himage = fopen ( $img, &quot;r&quot;); // read the temporary file into a buffer
 $image = fread ( $himage, filesize($img) );
 fclose($himage);
 //if image can&#039;t be opened, either its not a valid format or even an image:
 if ($image === FALSE) {
  echo &quot;{status:&#039;Error Reading Uploaded File.&#039;}&quot;;
  return;
 }
 // create a new random numeric name to avoid rewriting other images already on the server...
 // define the uploading dir
 $path = &quot;../../_content/content_temp.jpg&quot;;
 $hout=fopen($path,&quot;w&quot;);
 fwrite($hout,$image);
 
 $size = getimagesize(&quot;../../_content/content_temp.jpg&quot;);
	$temp_width = $size[0];
	$temp_height = $size[1];
	if($temp_width&gt;530)

sorry that part of the code was truncated for some reason</description>
		<content:encoded><![CDATA[<p>if (isset($_FILES['image']['tmp_name'])) {<br />
 // open the file<br />
 $img = $_FILES['image']['tmp_name'];<br />
 $himage = fopen ( $img, &#8220;r&#8221;); // read the temporary file into a buffer<br />
 $image = fread ( $himage, filesize($img) );<br />
 fclose($himage);<br />
 //if image can&#8217;t be opened, either its not a valid format or even an image:<br />
 if ($image === FALSE) {<br />
  echo &#8220;{status:&#8217;Error Reading Uploaded File.&#8217;}&#8221;;<br />
  return;<br />
 }<br />
 // create a new random numeric name to avoid rewriting other images already on the server&#8230;<br />
 // define the uploading dir<br />
 $path = &#8220;../../_content/content_temp.jpg&#8221;;<br />
 $hout=fopen($path,&#8221;w&#8221;);<br />
 fwrite($hout,$image);</p>
<p> $size = getimagesize(&#8220;../../_content/content_temp.jpg&#8221;);<br />
	$temp_width = $size[0];<br />
	$temp_height = $size[1];<br />
	if($temp_width&gt;530)</p>
<p>sorry that part of the code was truncated for some reason</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: beingaquatic</title>
		<link>http://allmybrain.com/2007/12/21/an-example-rich-text-editor-image-upload-with-php/comment-page-2/#comment-1210</link>
		<dc:creator>beingaquatic</dc:creator>
		<pubDate>Mon, 21 Nov 2011 15:15:33 +0000</pubDate>
		<guid isPermaLink="false">http://allmybrain.com/2007/12/21/an-example-rich-text-editor-image-upload-with-php/#comment-1210</guid>
		<description>to all those people looking to resize the image after uploading if it&#039;s too big, following code may help:

530)
	{
		$scale_constraint = $size[0]/530;
		$new_width = 530;
		$new_height = $temp_height/$scale_constraint;
	}
	else
	{
		$new_width = $temp_width;
		$new_height = $temp_height;
	}
	
	$thumb_src = &quot;_content/content_temp.jpg&quot;;
	ini_set(&#039;memory_limit&#039;, &#039;128M&#039;);
	$thumb_img_r = imagecreatefromjpeg($thumb_src);
	$thumb_dst_r = ImageCreateTrueColor( $new_width, $new_height);
	imagecopyresampled($thumb_dst_r, $thumb_img_r, 0, 0, 0, 0, $new_width, $new_height, $temp_width, $temp_height);
	$new_filename = &quot;HL_Content_&quot;.date(&quot;YmdHis&quot;).&quot;.jpg&quot;;
	$path = &quot;_content/&quot;.$new_filename;
	
	imagejpeg($thumb_dst_r, $path, 100);
	
 echo &quot;{status:&#039;UPLOADED&#039;, image_url:&#039;$path&#039;}&quot;;
} else {
 echo &quot;{status:&#039;No file was submitted&#039;}&quot;;
}
?&gt;

and the file names will be based on timestamp so pretty unique.</description>
		<content:encoded><![CDATA[<p>to all those people looking to resize the image after uploading if it&#8217;s too big, following code may help:</p>
<p>530)<br />
	{<br />
		$scale_constraint = $size[0]/530;<br />
		$new_width = 530;<br />
		$new_height = $temp_height/$scale_constraint;<br />
	}<br />
	else<br />
	{<br />
		$new_width = $temp_width;<br />
		$new_height = $temp_height;<br />
	}</p>
<p>	$thumb_src = &#8220;_content/content_temp.jpg&#8221;;<br />
	ini_set(&#8216;memory_limit&#8217;, &#8217;128M&#8217;);<br />
	$thumb_img_r = imagecreatefromjpeg($thumb_src);<br />
	$thumb_dst_r = ImageCreateTrueColor( $new_width, $new_height);<br />
	imagecopyresampled($thumb_dst_r, $thumb_img_r, 0, 0, 0, 0, $new_width, $new_height, $temp_width, $temp_height);<br />
	$new_filename = &#8220;HL_Content_&#8221;.date(&#8220;YmdHis&#8221;).&#8221;.jpg&#8221;;<br />
	$path = &#8220;_content/&#8221;.$new_filename;</p>
<p>	imagejpeg($thumb_dst_r, $path, 100);</p>
<p> echo &#8220;{status:&#8217;UPLOADED&#8217;, image_url:&#8217;$path&#8217;}&#8221;;<br />
} else {<br />
 echo &#8220;{status:&#8217;No file was submitted&#8217;}&#8221;;<br />
}<br />
?&gt;</p>
<p>and the file names will be based on timestamp so pretty unique.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: madhan</title>
		<link>http://allmybrain.com/2007/12/21/an-example-rich-text-editor-image-upload-with-php/comment-page-2/#comment-1181</link>
		<dc:creator>madhan</dc:creator>
		<pubDate>Tue, 21 Jun 2011 12:27:10 +0000</pubDate>
		<guid isPermaLink="false">http://allmybrain.com/2007/12/21/an-example-rich-text-editor-image-upload-with-php/#comment-1181</guid>
		<description>src=&quot;/wp-content/uploads/2007/10/yui-image-uploader.js</description>
		<content:encoded><![CDATA[<p>src=&#8221;/wp-content/uploads/2007/10/yui-image-uploader.js</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: madhan</title>
		<link>http://allmybrain.com/2007/12/21/an-example-rich-text-editor-image-upload-with-php/comment-page-2/#comment-1180</link>
		<dc:creator>madhan</dc:creator>
		<pubDate>Tue, 21 Jun 2011 12:26:35 +0000</pubDate>
		<guid isPermaLink="false">http://allmybrain.com/2007/12/21/an-example-rich-text-editor-image-upload-with-php/#comment-1180</guid>
		<description>i couldnt understand this line </description>
		<content:encoded><![CDATA[<p>i couldnt understand this line</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: madhan</title>
		<link>http://allmybrain.com/2007/12/21/an-example-rich-text-editor-image-upload-with-php/comment-page-2/#comment-1179</link>
		<dc:creator>madhan</dc:creator>
		<pubDate>Tue, 21 Jun 2011 12:25:47 +0000</pubDate>
		<guid isPermaLink="false">http://allmybrain.com/2007/12/21/an-example-rich-text-editor-image-upload-with-php/#comment-1179</guid>
		<description>i am confused about &#039;example_editor&#039; and  i couldnt understand this line &quot;&quot;</description>
		<content:encoded><![CDATA[<p>i am confused about &#8216;example_editor&#8217; and  i couldnt understand this line &#8220;&#8221;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: sonu sindhu</title>
		<link>http://allmybrain.com/2007/12/21/an-example-rich-text-editor-image-upload-with-php/comment-page-2/#comment-1175</link>
		<dc:creator>sonu sindhu</dc:creator>
		<pubDate>Mon, 06 Jun 2011 11:53:44 +0000</pubDate>
		<guid isPermaLink="false">http://allmybrain.com/2007/12/21/an-example-rich-text-editor-image-upload-with-php/#comment-1175</guid>
		<description>Sir tell me how to use this in my websites.</description>
		<content:encoded><![CDATA[<p>Sir tell me how to use this in my websites.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Nithin</title>
		<link>http://allmybrain.com/2007/12/21/an-example-rich-text-editor-image-upload-with-php/comment-page-2/#comment-1166</link>
		<dc:creator>Nithin</dc:creator>
		<pubDate>Mon, 28 Mar 2011 15:05:38 +0000</pubDate>
		<guid isPermaLink="false">http://allmybrain.com/2007/12/21/an-example-rich-text-editor-image-upload-with-php/#comment-1166</guid>
		<description>Hi,
This is a great example. Pls tell me how to pass image&#039;s alt and title values, if user hasn&#039;t entered it</description>
		<content:encoded><![CDATA[<p>Hi,<br />
This is a great example. Pls tell me how to pass image&#8217;s alt and title values, if user hasn&#8217;t entered it</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Brendan</title>
		<link>http://allmybrain.com/2007/12/21/an-example-rich-text-editor-image-upload-with-php/comment-page-2/#comment-1160</link>
		<dc:creator>Brendan</dc:creator>
		<pubDate>Tue, 22 Feb 2011 05:53:42 +0000</pubDate>
		<guid isPermaLink="false">http://allmybrain.com/2007/12/21/an-example-rich-text-editor-image-upload-with-php/#comment-1160</guid>
		<description>woops.. my code did not get in the post. You can view it here: http://iggraphic.com/test_code.html</description>
		<content:encoded><![CDATA[<p>woops.. my code did not get in the post. You can view it here: <a href="http://iggraphic.com/test_code.html" rel="nofollow">http://iggraphic.com/test_code.html</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Brendan</title>
		<link>http://allmybrain.com/2007/12/21/an-example-rich-text-editor-image-upload-with-php/comment-page-2/#comment-1159</link>
		<dc:creator>Brendan</dc:creator>
		<pubDate>Tue, 22 Feb 2011 05:49:52 +0000</pubDate>
		<guid isPermaLink="false">http://allmybrain.com/2007/12/21/an-example-rich-text-editor-image-upload-with-php/#comment-1159</guid>
		<description>Hi Dennis, 

Not sure what i am doing wrong here. The upload script works, the image gets uploaded, but I don&#039;t see the image in the editor.

here is where the editor is: http://iggraphic.com/test.php

Here is my PHP code:

</description>
		<content:encoded><![CDATA[<p>Hi Dennis, </p>
<p>Not sure what i am doing wrong here. The upload script works, the image gets uploaded, but I don&#8217;t see the image in the editor.</p>
<p>here is where the editor is: <a href="http://iggraphic.com/test.php" rel="nofollow">http://iggraphic.com/test.php</a></p>
<p>Here is my PHP code:</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Dennis</title>
		<link>http://allmybrain.com/2007/12/21/an-example-rich-text-editor-image-upload-with-php/comment-page-2/#comment-1154</link>
		<dc:creator>Dennis</dc:creator>
		<pubDate>Mon, 14 Feb 2011 17:44:08 +0000</pubDate>
		<guid isPermaLink="false">http://allmybrain.com/2007/12/21/an-example-rich-text-editor-image-upload-with-php/#comment-1154</guid>
		<description>I&#039;ll have to see if there are any editor differences that need a patch with the latest YUI version.</description>
		<content:encoded><![CDATA[<p>I&#8217;ll have to see if there are any editor differences that need a patch with the latest YUI version.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Castell</title>
		<link>http://allmybrain.com/2007/12/21/an-example-rich-text-editor-image-upload-with-php/comment-page-2/#comment-1153</link>
		<dc:creator>Castell</dc:creator>
		<pubDate>Mon, 14 Feb 2011 17:34:30 +0000</pubDate>
		<guid isPermaLink="false">http://allmybrain.com/2007/12/21/an-example-rich-text-editor-image-upload-with-php/#comment-1153</guid>
		<description>Hi there, i´ve used to get this script working on yui 2.8.2r1
but it stops at 

imgPanel.on ( &#039;contentReady&#039;, function() {..

Does anyone have an idea of what´s wrong with that line?

Any help is appreciated,
Castell</description>
		<content:encoded><![CDATA[<p>Hi there, i´ve used to get this script working on yui 2.8.2r1<br />
but it stops at </p>
<p>imgPanel.on ( &#8216;contentReady&#8217;, function() {..</p>
<p>Does anyone have an idea of what´s wrong with that line?</p>
<p>Any help is appreciated,<br />
Castell</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Dennis</title>
		<link>http://allmybrain.com/2007/12/21/an-example-rich-text-editor-image-upload-with-php/comment-page-2/#comment-1107</link>
		<dc:creator>Dennis</dc:creator>
		<pubDate>Sat, 13 Nov 2010 15:08:49 +0000</pubDate>
		<guid isPermaLink="false">http://allmybrain.com/2007/12/21/an-example-rich-text-editor-image-upload-with-php/#comment-1107</guid>
		<description>Just use Firebug w/ Firefox to see what is going on.  Compare to the example here.  I&#039;m sure you&#039;ll find a difference that is causing the error.</description>
		<content:encoded><![CDATA[<p>Just use Firebug w/ Firefox to see what is going on.  Compare to the example here.  I&#8217;m sure you&#8217;ll find a difference that is causing the error.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Chito</title>
		<link>http://allmybrain.com/2007/12/21/an-example-rich-text-editor-image-upload-with-php/comment-page-2/#comment-1106</link>
		<dc:creator>Chito</dc:creator>
		<pubDate>Sat, 13 Nov 2010 05:48:29 +0000</pubDate>
		<guid isPermaLink="false">http://allmybrain.com/2007/12/21/an-example-rich-text-editor-image-upload-with-php/#comment-1106</guid>
		<description>Referring to previous msg, the photo can&#039;t be uploaded, after I have chosen the photo, 

But then, I tried to upload a photo through ui_img_uploader.php directly, and it works!!!
(you can try here http://treescape.chito.hk/testimgupload.html)</description>
		<content:encoded><![CDATA[<p>Referring to previous msg, the photo can&#8217;t be uploaded, after I have chosen the photo, </p>
<p>But then, I tried to upload a photo through ui_img_uploader.php directly, and it works!!!<br />
(you can try here <a href="http://treescape.chito.hk/testimgupload.html" rel="nofollow">http://treescape.chito.hk/testimgupload.html</a>)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Chito</title>
		<link>http://allmybrain.com/2007/12/21/an-example-rich-text-editor-image-upload-with-php/comment-page-2/#comment-1105</link>
		<dc:creator>Chito</dc:creator>
		<pubDate>Sat, 13 Nov 2010 05:47:17 +0000</pubDate>
		<guid isPermaLink="false">http://allmybrain.com/2007/12/21/an-example-rich-text-editor-image-upload-with-php/#comment-1105</guid>
		<description>Hi Dennis,

Your example is amazing, and I want to implement it to my website.

But I have followed your sample, there&#039;s something wrong with my editor.

Here&#039;s my test editor
http://treescape.chito.hk/yuitest.html

I have no idea what the problem is between my .js and .php

Here&#039;s the .js and .php
http://treescape.chito.hk/yui-img-uploader.js

http://treescape.chito.hk/yui_img_uploader_code.php</description>
		<content:encoded><![CDATA[<p>Hi Dennis,</p>
<p>Your example is amazing, and I want to implement it to my website.</p>
<p>But I have followed your sample, there&#8217;s something wrong with my editor.</p>
<p>Here&#8217;s my test editor<br />
<a href="http://treescape.chito.hk/yuitest.html" rel="nofollow">http://treescape.chito.hk/yuitest.html</a></p>
<p>I have no idea what the problem is between my .js and .php</p>
<p>Here&#8217;s the .js and .php<br />
<a href="http://treescape.chito.hk/yui-img-uploader.js" rel="nofollow">http://treescape.chito.hk/yui-img-uploader.js</a></p>
<p><a href="http://treescape.chito.hk/yui_img_uploader_code.php" rel="nofollow">http://treescape.chito.hk/yui_img_uploader_code.php</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Brilver</title>
		<link>http://allmybrain.com/2007/12/21/an-example-rich-text-editor-image-upload-with-php/comment-page-2/#comment-1101</link>
		<dc:creator>Brilver</dc:creator>
		<pubDate>Thu, 04 Nov 2010 13:33:09 +0000</pubDate>
		<guid isPermaLink="false">http://allmybrain.com/2007/12/21/an-example-rich-text-editor-image-upload-with-php/#comment-1101</guid>
		<description>I checked can&#039;t find a solution..
These are the codes i tried.. Please help

My test file is

http://www.ceylontopjobs.com/emp/index.php</description>
		<content:encoded><![CDATA[<p>I checked can&#8217;t find a solution..<br />
These are the codes i tried.. Please help</p>
<p>My test file is</p>
<p><a href="http://www.ceylontopjobs.com/emp/index.php" rel="nofollow">http://www.ceylontopjobs.com/emp/index.php</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Dennis</title>
		<link>http://allmybrain.com/2007/12/21/an-example-rich-text-editor-image-upload-with-php/comment-page-2/#comment-1100</link>
		<dc:creator>Dennis</dc:creator>
		<pubDate>Thu, 04 Nov 2010 11:39:46 +0000</pubDate>
		<guid isPermaLink="false">http://allmybrain.com/2007/12/21/an-example-rich-text-editor-image-upload-with-php/#comment-1100</guid>
		<description>Sounds like something not related to the image uploader.  I think you&#039;ll find the best support for this on this problem on the yui forum.</description>
		<content:encoded><![CDATA[<p>Sounds like something not related to the image uploader.  I think you&#8217;ll find the best support for this on this problem on the yui forum.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Brilver</title>
		<link>http://allmybrain.com/2007/12/21/an-example-rich-text-editor-image-upload-with-php/comment-page-2/#comment-1099</link>
		<dc:creator>Brilver</dc:creator>
		<pubDate>Thu, 04 Nov 2010 10:11:01 +0000</pubDate>
		<guid isPermaLink="false">http://allmybrain.com/2007/12/21/an-example-rich-text-editor-image-upload-with-php/#comment-1099</guid>
		<description>I know, but the link to the uploaded image is not submitting. Only the text pre loaded with the page in textarea is submitting.. Please help..</description>
		<content:encoded><![CDATA[<p>I know, but the link to the uploaded image is not submitting. Only the text pre loaded with the page in textarea is submitting.. Please help..</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Dennis</title>
		<link>http://allmybrain.com/2007/12/21/an-example-rich-text-editor-image-upload-with-php/comment-page-2/#comment-1098</link>
		<dc:creator>Dennis</dc:creator>
		<pubDate>Mon, 01 Nov 2010 12:49:41 +0000</pubDate>
		<guid isPermaLink="false">http://allmybrain.com/2007/12/21/an-example-rich-text-editor-image-upload-with-php/#comment-1098</guid>
		<description>Images are uploaded at the time you select them and they appear in the editor.  Uploaded text contains links to the images only.</description>
		<content:encoded><![CDATA[<p>Images are uploaded at the time you select them and they appear in the editor.  Uploaded text contains links to the images only.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Brilver</title>
		<link>http://allmybrain.com/2007/12/21/an-example-rich-text-editor-image-upload-with-php/comment-page-2/#comment-1097</link>
		<dc:creator>Brilver</dc:creator>
		<pubDate>Mon, 01 Nov 2010 11:30:17 +0000</pubDate>
		<guid isPermaLink="false">http://allmybrain.com/2007/12/21/an-example-rich-text-editor-image-upload-with-php/#comment-1097</guid>
		<description>image is uploading to the richtext area. But when submitted only the text are submitting. Please help</description>
		<content:encoded><![CDATA[<p>image is uploading to the richtext area. But when submitted only the text are submitting. Please help</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Example Image Upload with YUI Rich Text Editor 2.7.0 &#124; All My Brain</title>
		<link>http://allmybrain.com/2007/12/21/an-example-rich-text-editor-image-upload-with-php/comment-page-2/#comment-1010</link>
		<dc:creator>Example Image Upload with YUI Rich Text Editor 2.7.0 &#124; All My Brain</dc:creator>
		<pubDate>Sat, 16 Jan 2010 14:15:53 +0000</pubDate>
		<guid isPermaLink="false">http://allmybrain.com/2007/12/21/an-example-rich-text-editor-image-upload-with-php/#comment-1010</guid>
		<description>[...] left the server side image upload script the same as with previous versions of this [...]</description>
		<content:encoded><![CDATA[<p>[...] left the server side image upload script the same as with previous versions of this [...]</p>
]]></content:encoded>
	</item>
</channel>
</rss>

