Re: Saving data in a component class

2010-07-12 Thread Elavazhagan chidambaram
".print_r($this->data,true)."";
if(!empty($this->data)){
echo "".print_r($this->data,true)."";
   if($this->data['Picture']['product_image']['name'] !=''){

if(isset($this->data['Picture']['product_image']['name'])){
$imgfile =
$_FILES['data']['tmp_name']['Picture']['product_image'];
$file_type =
$this->data['Picture']['product_image']['type'];
$file_name =
$this->data['Picture']['product_image']['name'];
$file_size =
$this->data['Picture']['product_image']['size'];
$img_size = getimagesize($imgfile);
   // $size= width="600"
height="400";
$new_filename = "product_img".time();
$destination = WWW_ROOT . DS. 'img' . DS .
'fish';
$path_thumbs = WWW_ROOT . DS. 'img' . DS .
'fish' . DS . 'thumbs';
$path = 'fish';
$img_thumb_width =50;
$img_thumb_height =50;
$getExt = explode ('.', $file_name);
$file_ext = $getExt[count($getExt)-1];
$aim_path = $destination . DS .
"$new_filename.$file_ext";
$realpath= WWW_ROOT .'img' . DS.'fish' . DS;
$target_path = $realpath;
$target_path = $target_path .
basename($new_filename.'.'.$file_ext);
$thumb_path = $path_thumbs . DS .
"$new_filename.$file_ext";
$this->Pthumb->pSetSize($img_thumb_width,
$img_thumb_height);
$this->Pthumb->pSetQuality(100);
$img_si[] =
$this->Pthumb->pCreate($imgfile,55,54,100);
$this->Pthumb->pSave($thumb_path);
$this->data['Picture']['imagename'] =
$new_filename.".".$file_ext;
$this->Pthumb->pSave($aim_path);

   // move_uploaded_file(
$_FILES['data']['tmp_name']['Picture']['product_image'], $target_path);
//   $img_thumb_width =800;
//   $img_thumb_height =600;
//$getExt = explode ('.', $file_name);
//$file_ext = $getExt[count($getExt)-1];
//$aim_path = $destination . DS .
"$new_filename.$file_ext";
//$thumb_path = $path_thumbs . DS .
"$new_filename.$file_ext";
//$this->Pthumb->pSetSize($img_thumb_width,
$img_thumb_height);
//$this->Pthumb->pSetQuality(100);
//$img_si[] =
$this->Pthumb->pCreate($imgfile,800,600,100);
   // $this->Pthumb->pSave($aim_path);
   // $this->Pthumb->pSave($thumb_path);
if($this->Picture->save($this->data)){
$this->set('userMessage','successfully saved');
}

}

}
 else{
$this->set('userMessage', 'Image cannot be empty');
}

 }
}
}
?>
On Mon, Jul 12, 2010 at 2:22 PM, nini  wrote:

> Hey,
>
> did you initialized your User model in initialize-function of your
> component? Seems to be not.
> Btw, for your purposes it already exists a nice thumbnail component:
> http://github.com/tute/Thumbnail-component-for-CakePHP
>
> On Jul 11, 7:20 pm, Tomfox Wiranata  wrote:
> > hi,
> >
> > i created a component "imageComponent" with a function that uploads
> > and resizes images. the components functions is called in my
> > users_controller. it works (thank god).
> > now i wanna save the path, where the profile picture is saved, in my
> > database.. i tried to save the path in my component with
> >
> >
> $data['User']['image_path']=$folderName."/".$filename;
> > Save the data
> > $this->User->save($data);
> >
> > thats the lovely error that cakephp is throwing
> >
> > Notice (8): Undefined property: ImageComponent::$User [APP\controllers
> > \components\image.php, line 105]
> > Code | Context
> >
> > Fatal error: Call to a member function save() on a non-object in F:\abc
> > \Entwicklung\xampp\htdocs\muh\app\controllers\components\image.php on
> > line 105
> >
> > thats 105:
> > $this->User->save($data);
> >
> > my component:
> >
> > class ImageComponent extends Object
> > {
> > function upload_image_and_thumbnail($data, $datakey, $imgscale,
> > $thumbscale, $folderName, $square) {
> > if (strlen($data['User'][

Re: Sessions across multiple apps, same domain

2010-07-12 Thread Elavazhagan chidambaram
hi u check this file core.php
compare with ur core file

On Mon, Jul 12, 2010 at 1:23 PM, Elavazhagan chidambaram <
azhagancod...@gmail.com> wrote:

>
> hi how can i help you?
>
> On Mon, Jul 12, 2010 at 1:18 PM, sophy  wrote:
>
>> Me too
>>
>> On Jul 1, 4:14 am, kevenages  wrote:
>> > I'm fairly new to cake, but an experienced PHP developer.  I have a
>> > production setup of cake.  It looks as follows:
>> >
>> > /home/keven/cake1.3 - This contains the 'spark_plug' plugin, which
>> > handles authentication
>> > /home/keven/app1
>> > /home/keven/app2
>> >
>> > Webroot is located here:
>> >
>> > /var/www/login
>> > /var/www/contest
>> > /var/www/game
>> >
>> > The idea is that a user logs in, then goes to another app where their
>> > login details are supposed to be kept within session data or the $user
>> > object from spark plug plugin.
>> >
>> > The problem is that sessions are not being passed app to app.  I've
>> > even tried to set a session explicitly in one app and tried to read it
>> > in another and it is blank. (ie, first app: $_SESSION['try'] = 'this'
>> > -- second app: print $_SESSION['try'];
>> >
>> > Any ideas would be greatly appreciated.  Thanks in advance everyone
>> >
>> >
>> 
>> >
>> > More about my setup:
>> >
>> > Cake 1.3.2
>> > Configure::write('Session.checkAgent', false);
>> > Configure::write('Security.level', 'medium'); *** I've also tried
>> > 'low'
>> > Configure::write('Security.salt',
>> > 'LKJd2ou43kljLKDJfkljueoiru34asdfk3'); *** this is the same across all
>> > apps
>> >
>> > I've read the following articles to no avail:
>> >
>> >
>> http://bakery.cakephp.org/articles/view/how-to-bend-cakephp-s-session...http://www.amityadav.name/cakephp-sharing-sessions-between-apps-on-th.
>> ..
>>
>> Check out the new CakePHP Questions site http://cakeqs.org and help
>> others with their CakePHP related questions.
>>
>> You received this message because you are subscribed to the Google Groups
>> "CakePHP" group.
>> To post to this group, send email to cake-php@googlegroups.com
>> To unsubscribe from this group, send email to
>> cake-php+unsubscr...@googlegroups.comFor
>>  more options, visit this group at
>> http://groups.google.com/group/cake-php?hl=en
>>
>
>

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
<>


Re: Sessions across multiple apps, same domain

2010-07-12 Thread Elavazhagan chidambaram
hi how can i help you?
On Mon, Jul 12, 2010 at 1:18 PM, sophy  wrote:

> Me too
>
> On Jul 1, 4:14 am, kevenages  wrote:
> > I'm fairly new to cake, but an experienced PHP developer.  I have a
> > production setup of cake.  It looks as follows:
> >
> > /home/keven/cake1.3 - This contains the 'spark_plug' plugin, which
> > handles authentication
> > /home/keven/app1
> > /home/keven/app2
> >
> > Webroot is located here:
> >
> > /var/www/login
> > /var/www/contest
> > /var/www/game
> >
> > The idea is that a user logs in, then goes to another app where their
> > login details are supposed to be kept within session data or the $user
> > object from spark plug plugin.
> >
> > The problem is that sessions are not being passed app to app.  I've
> > even tried to set a session explicitly in one app and tried to read it
> > in another and it is blank. (ie, first app: $_SESSION['try'] = 'this'
> > -- second app: print $_SESSION['try'];
> >
> > Any ideas would be greatly appreciated.  Thanks in advance everyone
> >
> >
> 
> >
> > More about my setup:
> >
> > Cake 1.3.2
> > Configure::write('Session.checkAgent', false);
> > Configure::write('Security.level', 'medium'); *** I've also tried
> > 'low'
> > Configure::write('Security.salt',
> > 'LKJd2ou43kljLKDJfkljueoiru34asdfk3'); *** this is the same across all
> > apps
> >
> > I've read the following articles to no avail:
> >
> >
> http://bakery.cakephp.org/articles/view/how-to-bend-cakephp-s-session...http://www.amityadav.name/cakephp-sharing-sessions-between-apps-on-th.
> ..
>
> Check out the new CakePHP Questions site http://cakeqs.org and help others
> with their CakePHP related questions.
>
> You received this message because you are subscribed to the Google Groups
> "CakePHP" group.
> To post to this group, send email to cake-php@googlegroups.com
> To unsubscribe from this group, send email to
> cake-php+unsubscr...@googlegroups.comFor
>  more options, visit this group at
> http://groups.google.com/group/cake-php?hl=en
>

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


Re: Problem with $this->Session->setFlash(__('Hidden value changed'));

2009-04-08 Thread Elavazhagan chidambaram
__()function is using Localization & Internationalization if u want the
__()function  $this->Session->setFlash(__('Hidden value
changed',true));otherwise

$this->Session->setFlash('Hidden value changed');On Tue, Apr 7, 2009 at 5:11
PM, Toby  wrote:

>
> Morning all,
>
> I have a problem with the following line in my code...
>
> $this->Session->setFlash(__('Hidden value changed'));
>
> It is printing the translated 'Hidden value changed' to the screen
> rather than setting the flash message.  If I remove the __() function
> it works fine.
>
> I can do this for this site as it is not an international site,
> however it irks me when things don't work as they should so could
> anyone shed some light on this problem?
>
> I haven't written this code but copied it from a blog post I found
> online, so it's not even something I have got wrong.
>
> Any help appreciated.
>
> Toby
> >
>

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: button with image

2009-04-08 Thread Elavazhagan chidambaram
end(array('type'=>'submit',*'class'=>'button'*,'value'=>'Post
Review','label'=>'Post Review'));?>
for example u add the image to css code
the *button** *css* *cla*ss u add the background image
this onway
*On Tue, Apr 7, 2009 at 9:26 PM, kryska  wrote:

>
> Thank you!
>
> It's correct:
>
> submit('myimage.png');?>
>
> But if i want to a label on the button...how is it? If i try:
>
> submit('img_tick.png',array ('label' => 'accept'));?
> >  is the same as
> submit('myimage.png');?>
>
> How can i write some text if i have an image?
>
> Thank you very much
>
> On Apr 7, 10:35 am, "Bogdan I. Bursuc" 
> wrote:
> > The correct way is: echo $form->submit('path_to_image.(jpg/png/etc)');
> > API link ->
> http://api.cakephp.org/class/form-helper#method-FormHelpersubmit
> >
> > > I need help
> >
> > > I just wanto to show an image inside a buttonmy code:
> >
> > > submit('Accept') ?>
> >
> > > I try this code, but is not correcto:
> > > submit('Accept', array('src'=>$this->'webroot.img/
> > > img_tick.png')); ?>
> >
> > > Any idea?
> >
> > > Thank you very much!
> >
>

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: multi-language support with different fields suffix

2009-04-08 Thread Elavazhagan chidambaram
see the articles. and then fallow step by step

http://book.cakephp.org/view/161/Localization-Internationalization

On Tue, Apr 7, 2009 at 9:49 PM, brian  wrote:

>
> See this article:
>
>
> http://www.palivoda.eu/2008/04/i18n-in-cakephp-12-database-content-translation-part-2/
>
> On Tue, Apr 7, 2009 at 8:46 AM, r zhuang  wrote:
> > I need to design a site with different language support. For example,
> when
> > somebody login in Germany, the system will show each field in Germany.
> When
> > somebody login in English, the system will show each field in English.
> >
> > I plan to design a table like this
> > [id, lang, content_en, content_gr, content_fr]
> >
> > The suffix of content will correspond to the selection of lang field.
> >
> > How to make this work? Anybody got any experience?
> >
> > Thanks,
> >
> > >
> >
>
> >
>

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Paginator with "table name"."field"

2009-04-08 Thread Elavazhagan chidambaram
this is ur code sort('MUNICIPIO',
'Municipio.Nome_municipio'); ?>

this code right code sortBy('Municipio.Nome_municipio', 'MUNICIPIO'); ?>




On Tue, Apr 7, 2009 at 9:34 PM, Celso  wrote:

>
> Hi! I have this problem:
>
> sort('MUNICIPIO',
> 'Municipio.Nome_municipio'); ?>
>
> result in:
>
>a href=" ... /sort:Municipio.Nome_municipio/ ...
>
> next("Proximo"); ?>
>
> result in:
>
>a href="  ... /sort:Nome_municipio/ ...
>
>
> Only works with same model...
> Why?
>
> Celso.
>
>
> >
>

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---