<?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: Two CakePHP behaviours to extend MeioUpload</title>
	<atom:link href="http://www.flipflops.org/2009/06/29/two-cakephp-behaviours-to-extend-meioupload/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.flipflops.org/2009/06/29/two-cakephp-behaviours-to-extend-meioupload/</link>
	<description>Flipflops.org is about web development and fairly conceptual art</description>
	<lastBuildDate>Tue, 31 Jan 2012 00:19:41 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
<xhtml:meta xmlns:xhtml="http://www.w3.org/1999/xhtml" name="robots" content="noindex" />
	<item>
		<title>By: Flipflops</title>
		<link>http://www.flipflops.org/2009/06/29/two-cakephp-behaviours-to-extend-meioupload/#comment-13395</link>
		<dc:creator>Flipflops</dc:creator>
		<pubDate>Thu, 11 Nov 2010 21:02:22 +0000</pubDate>
		<guid isPermaLink="false">http://www.flipflops.org/2009/06/29/two-cakephp-behaviours-to-extend-meioupload/#comment-13395</guid>
		<description>Hi

I&#039;m glad that it has come in useful. Thanks for your comments, I&#039;ll try and follow them up - about the UploadVariant. 

I use the behaviours on a couple of sites, but to tell the truth I haven&#039;t done any new work with Cake for over a year now.

Cheers</description>
		<content:encoded><![CDATA[<p>Hi</p>
<p>I&#8217;m glad that it has come in useful. Thanks for your comments, I&#8217;ll try and follow them up &#8211; about the UploadVariant. </p>
<p>I use the behaviours on a couple of sites, but to tell the truth I haven&#8217;t done any new work with Cake for over a year now.</p>
<p>Cheers</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: slvolz</title>
		<link>http://www.flipflops.org/2009/06/29/two-cakephp-behaviours-to-extend-meioupload/#comment-13393</link>
		<dc:creator>slvolz</dc:creator>
		<pubDate>Wed, 10 Nov 2010 19:11:38 +0000</pubDate>
		<guid isPermaLink="false">http://www.flipflops.org/2009/06/29/two-cakephp-behaviours-to-extend-meioupload/#comment-13393</guid>
		<description>Great extension to MeioUpload behavior!  

I have gotten it to work on upload and delete.  The polymorphic deletion was not working at all.  At least not for the UploadVariant.  So I did a custom deletion process.  

I would like to suggest that in the je_meio_upload.php behavior that at the for loop of the creation of the UploadVariant (line 495-500?) that you do not add entries for any variant named &#039;normal&#039;.  This is something that meio_upload uses to overwrite the existing upload to a modified image size as per your options.  There is not a normal variant actually created so there is no need to add a entry to the table for it.</description>
		<content:encoded><![CDATA[<p>Great extension to MeioUpload behavior!  </p>
<p>I have gotten it to work on upload and delete.  The polymorphic deletion was not working at all.  At least not for the UploadVariant.  So I did a custom deletion process.  </p>
<p>I would like to suggest that in the je_meio_upload.php behavior that at the for loop of the creation of the UploadVariant (line 495-500?) that you do not add entries for any variant named &#8216;normal&#8217;.  This is something that meio_upload uses to overwrite the existing upload to a modified image size as per your options.  There is not a normal variant actually created so there is no need to add a entry to the table for it.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: alonso</title>
		<link>http://www.flipflops.org/2009/06/29/two-cakephp-behaviours-to-extend-meioupload/#comment-13369</link>
		<dc:creator>alonso</dc:creator>
		<pubDate>Mon, 06 Sep 2010 19:06:23 +0000</pubDate>
		<guid isPermaLink="false">http://www.flipflops.org/2009/06/29/two-cakephp-behaviours-to-extend-meioupload/#comment-13369</guid>
		<description>thx tuto, but..

how can display the image?

$html-&gt;image($upload[&#039;Upload&#039;][&#039;dir&#039;].$upload[&#039;Upload&#039;][&#039;filename&#039;]); ??????</description>
		<content:encoded><![CDATA[<p>thx tuto, but..</p>
<p>how can display the image?</p>
<p>$html-&gt;image($upload['Upload']['dir'].$upload['Upload']['filename']); ??????</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Flipflops</title>
		<link>http://www.flipflops.org/2009/06/29/two-cakephp-behaviours-to-extend-meioupload/#comment-13255</link>
		<dc:creator>Flipflops</dc:creator>
		<pubDate>Tue, 09 Mar 2010 01:01:42 +0000</pubDate>
		<guid isPermaLink="false">http://www.flipflops.org/2009/06/29/two-cakephp-behaviours-to-extend-meioupload/#comment-13255</guid>
		<description>@unidev

Yeah, you could do that, I wouldn&#039;t say there is a real right or wrong way though. I&#039;ve attached a couple of code fragments as to how I use it. Unfortunately though since I wrote this, I&#039;ve done very little Cake based stuff (new jobs etc.) although I am doing some more soon so want to have another look at this all.

The code fragments are taken from the admin section of my CMS

&lt;strong&gt;Controller:&lt;/strong&gt;
&lt;pre lang=&quot;php&quot; line=&quot;1&quot;&gt;
$contain = array(
			&#039;UploadVariant&#039;
		);
		
		
		
		
		
		$this-&gt;paginate = array(
							&#039;Upload&#039;=&gt;array(
											&#039;limit&#039; =&gt; 20,
											&#039;contain&#039; =&gt; array(&#039;UploadVariant.variant = &quot;small&quot;&#039;),
											&#039;order&#039; =&gt; array(&#039;Upload.id&#039; =&gt; &#039;DESC&#039;)
							)
		); 
		
		$this-&gt;data = $this-&gt;paginate($conditions);
&lt;/pre&gt; 

&lt;strong&gt;Helper:&lt;/strong&gt;
This just takes creates a thumbnail and opens a full size version.
&lt;pre lang=&quot;php&quot; line=&quot;1&quot;&gt;
&lt;?php

class UploadHelper extends AppHelper {
	
	var $helpers = array(&#039;Html&#039;, &#039;Form&#039;);
	
	var $uploadModel = &#039;Upload&#039;;
	var $uploadModelVariant = &#039;UploadVariant&#039;;
	
	public function showThumb(&amp;$data, &amp;$sub_data = null, $rel = null){
		
		$str = &#039;&#039;;
		
		$dir = WWW_ROOT . $this-&gt;getRealDir($data[&#039;dir&#039;]);
		$web_dir = &#039;/&#039; . $this-&gt;getWebDir($data[&#039;dir&#039;]);
		
		
		
		if(file_exists($dir . DS . $data[&#039;filename&#039;])) {
			
		
		
			
			if($data[&#039;quick_type&#039;] == &#039;image&#039;){
				

				if(!empty($sub_data[&#039;filename&#039;])){
					
					
					
					if(file_exists($dir . DS . $sub_data[&#039;filename&#039;])){
						
						$image = $this-&gt;Html-&gt;image($web_dir . &#039;/&#039; . $sub_data[&#039;filename&#039;], array(&#039;alt&#039; =&gt; &#039;&#039;, &#039;height&#039; =&gt; $sub_data[&#039;height&#039;], &#039;height&#039; =&gt; $sub_data[&#039;height&#039;]));
						
						$str .= $this-&gt;Html-&gt;link($image, $web_dir . &#039;/&#039; . $data[&#039;filename&#039;],array(&#039;class&#039; =&gt; &#039;thickbox&#039;, &#039;rel&#039; =&gt; $rel), false, false);
						
					} else {
						
						
						
					}
				} else {
					
					
				}
				
			} else {
				$str .= $this-&gt;Html-&gt;link($data[&#039;filename&#039;], $web_dir. DS . $data[&#039;filename&#039;],array(&#039;target&#039; =&gt; &#039;_blank&#039;), false, false);
			}
			
		} else {
			
			$str = &#039;Missing File&#039;;
			
		}
		
		
		return $this-&gt;output($str);
		
	}
	
	protected function getRealDir($dir){
		$dir = r(&#039;\\&#039;, DS, $dir);
		$dir = r(&#039;/&#039;, DS, $dir);
		return $dir;
	}
	
	protected function getWebDir($dir){
		$dir = r(&#039;\\&#039;, &#039;/&#039;, $dir);
		return $dir;
	}
	
	
	
}

?&gt;
&lt;/pre&gt;

&lt;strong&gt;View:&lt;/strong&gt;
&lt;pre lang=&quot;php&quot; line=&quot;1&quot;&gt;
echo $upload-&gt;showThumb($var[&#039;Upload&#039;], $var[&#039;UploadVariant&#039;][0]);
&lt;/pre&gt;

Thinking about it, you would usually know exactly what variant you are after so between the containable behaviour to filter the data and then possibly some use of array_key_exists() in the view you should be able to end up with some very neat code.

Hope this helps.

John</description>
		<content:encoded><![CDATA[<p>@unidev</p>
<p>Yeah, you could do that, I wouldn&#8217;t say there is a real right or wrong way though. I&#8217;ve attached a couple of code fragments as to how I use it. Unfortunately though since I wrote this, I&#8217;ve done very little Cake based stuff (new jobs etc.) although I am doing some more soon so want to have another look at this all.</p>
<p>The code fragments are taken from the admin section of my CMS</p>
<p><strong>Controller:</strong></p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$contain</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span>
			<span style="color: #0000ff;">'UploadVariant'</span>
		<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
&nbsp;
&nbsp;
&nbsp;
&nbsp;
		<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">paginate</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span>
							<span style="color: #0000ff;">'Upload'</span><span style="color: #339933;">=&gt;</span>array<span style="color: #009900;">&#40;</span>
											<span style="color: #0000ff;">'limit'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #cc66cc;">20</span><span style="color: #339933;">,</span>
											<span style="color: #0000ff;">'contain'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'UploadVariant.variant = &quot;small&quot;'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>
											<span style="color: #0000ff;">'order'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Upload.id'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'DESC'</span><span style="color: #009900;">&#41;</span>
							<span style="color: #009900;">&#41;</span>
		<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> 
&nbsp;
		<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">data</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">paginate</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$conditions</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<p><strong>Helper:</strong><br />
This just takes creates a thumbnail and opens a full size version.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">class</span> UploadHelper <span style="color: #000000; font-weight: bold;">extends</span> AppHelper <span style="color: #009900;">&#123;</span>
&nbsp;
	<span style="color: #000000; font-weight: bold;">var</span> <span style="color: #000088;">$helpers</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Html'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'Form'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #000000; font-weight: bold;">var</span> <span style="color: #000088;">$uploadModel</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'Upload'</span><span style="color: #339933;">;</span>
	<span style="color: #000000; font-weight: bold;">var</span> <span style="color: #000088;">$uploadModelVariant</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'UploadVariant'</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">function</span> showThumb<span style="color: #009900;">&#40;</span><span style="color: #339933;">&amp;</span><span style="color: #000088;">$data</span><span style="color: #339933;">,</span> <span style="color: #339933;">&amp;</span><span style="color: #000088;">$sub_data</span> <span style="color: #339933;">=</span> <span style="color: #009900; font-weight: bold;">null</span><span style="color: #339933;">,</span> <span style="color: #000088;">$rel</span> <span style="color: #339933;">=</span> <span style="color: #009900; font-weight: bold;">null</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
&nbsp;
		<span style="color: #000088;">$str</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">''</span><span style="color: #339933;">;</span>
&nbsp;
		<span style="color: #000088;">$dir</span> <span style="color: #339933;">=</span> WWW_ROOT <span style="color: #339933;">.</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getRealDir</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$data</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'dir'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #000088;">$web_dir</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'/'</span> <span style="color: #339933;">.</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getWebDir</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$data</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'dir'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
&nbsp;
&nbsp;
		<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">file_exists</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$dir</span> <span style="color: #339933;">.</span> DS <span style="color: #339933;">.</span> <span style="color: #000088;">$data</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'filename'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
&nbsp;
&nbsp;
&nbsp;
&nbsp;
			<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$data</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'quick_type'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">==</span> <span style="color: #0000ff;">'image'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
&nbsp;
&nbsp;
				<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span><span style="color: #990000;">empty</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$sub_data</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'filename'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
&nbsp;
&nbsp;
&nbsp;
					<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">file_exists</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$dir</span> <span style="color: #339933;">.</span> DS <span style="color: #339933;">.</span> <span style="color: #000088;">$sub_data</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'filename'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
&nbsp;
						<span style="color: #000088;">$image</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">Html</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">image</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$web_dir</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">'/'</span> <span style="color: #339933;">.</span> <span style="color: #000088;">$sub_data</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'filename'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'alt'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">''</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'height'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #000088;">$sub_data</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'height'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'height'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #000088;">$sub_data</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'height'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
						<span style="color: #000088;">$str</span> <span style="color: #339933;">.=</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">Html</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">link</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$image</span><span style="color: #339933;">,</span> <span style="color: #000088;">$web_dir</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">'/'</span> <span style="color: #339933;">.</span> <span style="color: #000088;">$data</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'filename'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span><span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'class'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'thickbox'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'rel'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #000088;">$rel</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> <span style="color: #009900; font-weight: bold;">false</span><span style="color: #339933;">,</span> <span style="color: #009900; font-weight: bold;">false</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
					<span style="color: #009900;">&#125;</span> <span style="color: #b1b100;">else</span> <span style="color: #009900;">&#123;</span>
&nbsp;
&nbsp;
&nbsp;
					<span style="color: #009900;">&#125;</span>
				<span style="color: #009900;">&#125;</span> <span style="color: #b1b100;">else</span> <span style="color: #009900;">&#123;</span>
&nbsp;
&nbsp;
				<span style="color: #009900;">&#125;</span>
&nbsp;
			<span style="color: #009900;">&#125;</span> <span style="color: #b1b100;">else</span> <span style="color: #009900;">&#123;</span>
				<span style="color: #000088;">$str</span> <span style="color: #339933;">.=</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">Html</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">link</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$data</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'filename'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$web_dir</span><span style="color: #339933;">.</span> DS <span style="color: #339933;">.</span> <span style="color: #000088;">$data</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'filename'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span><span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'target'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'_blank'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> <span style="color: #009900; font-weight: bold;">false</span><span style="color: #339933;">,</span> <span style="color: #009900; font-weight: bold;">false</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			<span style="color: #009900;">&#125;</span>
&nbsp;
		<span style="color: #009900;">&#125;</span> <span style="color: #b1b100;">else</span> <span style="color: #009900;">&#123;</span>
&nbsp;
			<span style="color: #000088;">$str</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'Missing File'</span><span style="color: #339933;">;</span>
&nbsp;
		<span style="color: #009900;">&#125;</span>
&nbsp;
&nbsp;
		<span style="color: #b1b100;">return</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">output</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$str</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #009900;">&#125;</span>
&nbsp;
	<span style="color: #000000; font-weight: bold;">protected</span> <span style="color: #000000; font-weight: bold;">function</span> getRealDir<span style="color: #009900;">&#40;</span><span style="color: #000088;">$dir</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
		<span style="color: #000088;">$dir</span> <span style="color: #339933;">=</span> r<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'\\'</span><span style="color: #339933;">,</span> DS<span style="color: #339933;">,</span> <span style="color: #000088;">$dir</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #000088;">$dir</span> <span style="color: #339933;">=</span> r<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'/'</span><span style="color: #339933;">,</span> DS<span style="color: #339933;">,</span> <span style="color: #000088;">$dir</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #b1b100;">return</span> <span style="color: #000088;">$dir</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
&nbsp;
	<span style="color: #000000; font-weight: bold;">protected</span> <span style="color: #000000; font-weight: bold;">function</span> getWebDir<span style="color: #009900;">&#40;</span><span style="color: #000088;">$dir</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
		<span style="color: #000088;">$dir</span> <span style="color: #339933;">=</span> r<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'\\'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'/'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$dir</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #b1b100;">return</span> <span style="color: #000088;">$dir</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
&nbsp;
&nbsp;
&nbsp;
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></td></tr></table></div>

<p><strong>View:</strong></p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #b1b100;">echo</span> <span style="color: #000088;">$upload</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">showThumb</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$var</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'Upload'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$var</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'UploadVariant'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<p>Thinking about it, you would usually know exactly what variant you are after so between the containable behaviour to filter the data and then possibly some use of array_key_exists() in the view you should be able to end up with some very neat code.</p>
<p>Hope this helps.</p>
<p>John</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: unidev</title>
		<link>http://www.flipflops.org/2009/06/29/two-cakephp-behaviours-to-extend-meioupload/#comment-13253</link>
		<dc:creator>unidev</dc:creator>
		<pubDate>Fri, 05 Mar 2010 16:35:48 +0000</pubDate>
		<guid isPermaLink="false">http://www.flipflops.org/2009/06/29/two-cakephp-behaviours-to-extend-meioupload/#comment-13253</guid>
		<description>Sorry, to further my query - do you even query the UploadVariants or just call the images by prepending the variant name to the Upload filename ie:

$html-&gt;image(&#039;thumb.&#039;.$product[&#039;Upload&#039;][0][&#039;filename&#039;]);</description>
		<content:encoded><![CDATA[<p>Sorry, to further my query &#8211; do you even query the UploadVariants or just call the images by prepending the variant name to the Upload filename ie:</p>
<p>$html-&gt;image(&#8216;thumb.&#8217;.$product['Upload'][0]['filename']);</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: unidev</title>
		<link>http://www.flipflops.org/2009/06/29/two-cakephp-behaviours-to-extend-meioupload/#comment-13252</link>
		<dc:creator>unidev</dc:creator>
		<pubDate>Fri, 05 Mar 2010 16:29:39 +0000</pubDate>
		<guid isPermaLink="false">http://www.flipflops.org/2009/06/29/two-cakephp-behaviours-to-extend-meioupload/#comment-13252</guid>
		<description>hey there!
thanks for the great example! Could you give a brief example of how you retrieve the variant images for the product? I have managed it, but it seems very long winded and feel I may be missing a trick?
Cheers!</description>
		<content:encoded><![CDATA[<p>hey there!<br />
thanks for the great example! Could you give a brief example of how you retrieve the variant images for the product? I have managed it, but it seems very long winded and feel I may be missing a trick?<br />
Cheers!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Flipflops</title>
		<link>http://www.flipflops.org/2009/06/29/two-cakephp-behaviours-to-extend-meioupload/#comment-11946</link>
		<dc:creator>Flipflops</dc:creator>
		<pubDate>Thu, 09 Jul 2009 12:33:18 +0000</pubDate>
		<guid isPermaLink="false">http://www.flipflops.org/2009/06/29/two-cakephp-behaviours-to-extend-meioupload/#comment-11946</guid>
		<description>No worries. Slightly odd error though, must be to do with the public modifiers on the class methods or something like that.</description>
		<content:encoded><![CDATA[<p>No worries. Slightly odd error though, must be to do with the public modifiers on the class methods or something like that.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ilia</title>
		<link>http://www.flipflops.org/2009/06/29/two-cakephp-behaviours-to-extend-meioupload/#comment-11945</link>
		<dc:creator>Ilia</dc:creator>
		<pubDate>Thu, 09 Jul 2009 12:29:16 +0000</pubDate>
		<guid isPermaLink="false">http://www.flipflops.org/2009/06/29/two-cakephp-behaviours-to-extend-meioupload/#comment-11945</guid>
		<description>It was my fault, my PHP was 4.4... upgrade to 5.2 fix it, thanks</description>
		<content:encoded><![CDATA[<p>It was my fault, my PHP was 4.4&#8230; upgrade to 5.2 fix it, thanks</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Flipflops</title>
		<link>http://www.flipflops.org/2009/06/29/two-cakephp-behaviours-to-extend-meioupload/#comment-11944</link>
		<dc:creator>Flipflops</dc:creator>
		<pubDate>Thu, 09 Jul 2009 12:06:26 +0000</pubDate>
		<guid isPermaLink="false">http://www.flipflops.org/2009/06/29/two-cakephp-behaviours-to-extend-meioupload/#comment-11944</guid>
		<description>Very weird. I just down loaded the zip file and and installed it and it runs without any problem once I set up the database of course...</description>
		<content:encoded><![CDATA[<p>Very weird. I just down loaded the zip file and and installed it and it runs without any problem once I set up the database of course&#8230;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Flipflops</title>
		<link>http://www.flipflops.org/2009/06/29/two-cakephp-behaviours-to-extend-meioupload/#comment-11943</link>
		<dc:creator>Flipflops</dc:creator>
		<pubDate>Thu, 09 Jul 2009 11:40:49 +0000</pubDate>
		<guid isPermaLink="false">http://www.flipflops.org/2009/06/29/two-cakephp-behaviours-to-extend-meioupload/#comment-11943</guid>
		<description>Thanks

I&#039;ll check that out right away and fix it.</description>
		<content:encoded><![CDATA[<p>Thanks</p>
<p>I&#8217;ll check that out right away and fix it.</p>
]]></content:encoded>
	</item>
</channel>
</rss>

