Not signed in (Sign In)
Welcome Guest!
Want to take part in these discussions? If you have an account, sign in now.
If you don't have an account, apply for one now.
    • CommentAuthoredward
    • CommentTimeDec 14th 2007
     

    Hello,

    I am trying to add Images to a listing of a property.

    Model: Property has many Images

    Image: belongs to Property

    view:

    <label for="property_zipcode">_{Zipcode}</label><br />
    <?php  echo $active_record_helper->input('property', 'zipcode')?>
    
    <label for="image_image1">_{Image1}</label><br />
    file_field('image', 'image1')?>
    

    controller:

    function add()
    {
        if(!empty($this->params['property'])){
            $this->Property->setAttributes($this->params['property']);
            $this->Property->image->set($this->params['image']);
            if ($this->Request->isPost() && $this->Property->save()){
                Ak::file_puts_contents();
                $this->flash['notice'] = $this->t('Property was successfully created.');
                $this->redirectTo(array('action' => 'show', 'id' => $this->Property->getId()));
            }
        }
    }
    

    error:

    Call to a member function on a non-object in /Users/xxxx/lib/AkActiveRecord/AkHasMany.php on line 292
    

    I realize that set might not be the proper thing to use. However, could anyone demonstrate how to get this working? i've been searching around but couldn't find it.

    What I need is to save the images uploaded to the Image table which is connected to the Property Model through a has many relationship.

    I used cakephp and all i had to do was this: $this->Property->Image->set($this->data['Image']); and it would take care of saving the Image record into the Image database.

    • CommentAuthoredward
    • CommentTimeDec 14th 2007 edited
     

    well, i figured out how to link the image information.

    however, i still have problems with uploading an image.

    this is not working:

    Ak::file_put_contents('myfile4.jpeg',$this->params['image']['image1'], array('base_path'=>'public/images/')
    

    what exactly goes in the second param, $content .

    • CommentAuthoredward
    • CommentTimeDec 14th 2007
     

    good news, i found the solution.

    however, has anyone worked with producing thumbnails? just curious if anyone has a working example.

    • CommentAuthorsuthern
    • CommentTimeDec 14th 2007 edited
     

    With Akelos, or PHP in general?

    There are several image-handling classes available. Have you tried searching on www.php-classes.org?

    • CommentAuthoredward
    • CommentTimeDec 15th 2007 edited
     

    with Akelos.

    i've used phpThumb in cakephp before, but i wanted to know if there was a better technique in Akelos.

    • CommentAuthorKaste
    • CommentTimeDec 15th 2007
     

    => AkImage

    test/unit/lib/AkImage.php should lead you in the right direction.

Add your comments
    Username Password
  • Format comments as