Hey guys,
I'm new to cakePHP and MVC as well so maybe I got some major design flaws 
in my attempt. Excuse my spelling as well since im not a native speaker.

*What I'm trying to do:*
I want to create a view where the user can re-crop uploaded images using 
the Jcrop Javascript lib <http://deepliquid.com/content/Jcrop.html> and the 
Media 
Plugin from David Persson <https://github.com/bmcclure/CakePHP-Media-Plugin>
.

*Setup:*
All mediafiles are stored by the Attachment Model which is based of the one 
shipped with the Mediaplugin.
Other Models can use the Attachment Model to store mediafiles.

*My Attempt:*
Step 1 (*View/Attachments/admin_edit.ctp*): Gather cropdata, data will 
injected to the form via javascript
Step 2 (Controller/AttachmentsController.php)
        2.1: Save attachment data
        2.2: if attachment data was saved: process cropdata with use of 
*$this->Attachment->makeVersion($file, 
$instructions);*
        2.3: redirect to attachments indexview using  
*$this->redirect(array($admin 
= true, 'controller' => 'attachments', 'action' => 'index'));*

*Issue:*
My general attempt is working, so all images get croped like i want them to 
but the following redirect isn't fired, instead a weird redirect to current 
action is executed somewhere.
I narrowed it down to the *makeVersion() *method, when i comment that out, 
the attachment gets still saved and the redirect is working like it's 
supposed to.

So it seems that *makeVersion() *has some weird sideeffect.

Since i get redirected it is really hard to debug because i cannot inspect 
the request or check for errors.
I tried with using debug();exit; to narrow it further down inside of the 
makeVersion() method but i really don't get this, theres no redirects 
called anywhere inside.

*Code:*
For anyone still reading and interested in helping me, check out the source 
here 
<https://github.com/KingLoui/mediatest/blob/master/app/Controller/AttachmentsController.php>
.

Thanks in advance for your effort!
Cheers
Mathias

-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to cake-php+unsubscr...@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.

Reply via email to