Wednesday, February 29, 2012

Re: Media Plugin - Getting Started

Hi to all, 
I'm trying to handle with video files, but with no luck. 
I'm working on this stuff 
var $validate = array(
'file' => array(
'resource'   => array('rule' => 'checkResource'),
'access'     => array('rule' => 'checkAccess'),
'location'   => array('rule' => array('checkLocation', array(
MEDIA_TRANSFER, '/tmp/'
))),
'extension'  => array('rule' => array('checkExtension', false, array(
'jpg', 'jpeg', 'png', 'tif', 'tiff', 'gif', 'pdf', 'tmp','avi','mpeg'
))),
'mimeType'   => array('rule' => array('checkMimeType', false, array(
'image/jpeg', 'image/png', 'image/tiff', 'image/gif', 'application/pdf','video/x-msvideo','video/vnd.mpegurl','video/mpeg'
)))));


Il giorno mercoledì 7 luglio 2010 04:26:16 UTC+2, dbme ha scritto:
Awesome! So what is your directory structure (step 3)?

Is it

app/webroot/media/static/
app/webroot/media/filter/
app/transfer/

OR

app/webroot/media/static/
app/webroot/media/filter/
app/webroot/media/transfer/

Also, did the styles still get served properly after step 5
(protecting the transfer directory)?

I would love to see how you made it work! Would you mind posting an
example or emailing me the relevant code?
If I can get it working I think it would be great to add this as a
full-on tutorial in the wiki.

Thank you!!


On Jul 6, 6:11 pm, randy <ran...@gmail.com> wrote:
> So glad to see someone else is taking a crack at this...
>
> Thanks to your post i was able to make a bit of headway...when i set
> this up the first time I had troubles with getting things right in my
> bootstrap.php file. However, i had a fairly easy time with other parts
> of this, namely the actual file-upload and metadata fields.
>
> I just set this up again using your instructions for bootstrap.php,
> and with just a few more adjustments I have it uploading files to the
> transfer directory and spitting out copies of the original, in
> different sizes.
>
> There are just two more things that I want to get working...I'd like
> to use the Media Helper to pull in my uploaded images, and, most
> importantly, I'd like to get the file-renaming functionality working
> so that users don't overwrite each others files. This also makes it
> tough to guess filenames if people go fishing for the uploaded images.
>
> I am running this on a cake 1.3 setup in case anyone was wondering.
>
> On Jul 5, 1:30 pm, dbme <boston.dus...@gmail.com> wrote:
>
> > I'm just getting started with CakePHP and also David Persson's Media
> > plugin (http://github.com/davidpersson/media). I've got my app working
> > but I'm having a difficult time getting the Media plugin working. I
> > figured I'd start this thread so I could A.) get it working and B.)
> > create a reference for beginners like me.
>
> > Here's what I've done so far (following the README and Configuration
> > wiki -http://wiki.github.com/davidpersson/media/configuration). Steps
> > marked with a * didn't go as documented :(
>
> > 1. Download and extract the files to /path/to/your/app/plugins/media
> > 2. Include the Media plugin config file in the /path/to/your/app/
> > config/bootstrap.php
>
> >         define ( 'MEDIA_TRANSFER', APP . 'transfer' . DS);
> >         define ( 'MEDIA_TRANSFER_URL', false);
> >         require APP . 'plugins/media/config/core.php';
>
> > * 3. Create the directory structure using the console
>
> > cd  /path/to/your/app/
> > ../cake/console/cake media init
>
> > The Configuration wiki says that there should be a static, filter, and
> > transfer directory under the webroot/media/ directory but the command
> > above will put the transfer directory under the app directory. Not
> > sure if this is how it should be or if I did something wrong.
>
> > * 4. Copy/move/collect the media into the new location
>
> > ../cake/console/cake media collect
>
> > But this results in a bunch of errors :(
>
> > --------------------------------------------------------------------------- -----
> > Media Shell
> > --------------------------------------------------------------------------- -----
> > PHP Warning:  Invalid argument supplied for foreach() in /path/to/your/
> > app/plugins/media/vendors/shells/tasks/collect.php on line 119
>
> > Warning: Invalid argument supplied for foreach() in /path/to/your/app/
> > plugins/media/vendors/shells/tasks/collect.php on line 119
> > PHP Notice:  Undefined variable: pluginVendorPaths in /var/www/
> > portfolio/app/plugins/media/vendors/shells/tasks/collect.php on line
> > 130
>
> > Notice: Undefined variable: pluginVendorPaths in /path/to/your/app/
> > plugins/media/vendors/shells/tasks/collect.php on line 130
> > PHP Warning:  array_merge(): Argument #1 is not an array in /path/to/
> > your/app/plugins/media/vendors/shells/tasks/collect.php on line 130
>
> > Warning: array_merge(): Argument #1 is not an array in /path/to/your/
> > app/plugins/media/vendors/shells/tasks/collect.php on line 130
> > PHP Warning:  Invalid argument supplied for foreach() in /path/to/your/
> > app/plugins/media/vendors/shells/tasks/collect.php on line 132
>
> > Warning: Invalid argument supplied for foreach() in /path/to/your/app/
> > plugins/media/vendors/shells/tasks/collect.php on line 132
> > Would you like to add another path?
>
> > So I'm assuming maybe I've done something wrong. I will press on and
> > instead just move the files manually:
>
> > mv webroot/js/* webroot/media/static/js/
> > mv webroot/css/* webroot/media/static/css/
> > mv webroot/img/* webroot/media/static/img/
> > mv webroot/vendors/js/* webroot/media/static/js/
> > mv webroot/vendors/css/* webroot/media/static/css/
> > mv webroot/vendors/img/* webroot/media/static/img/
>
> > That works, minus the vendors directory (because I dont have one).
> > At this point the app is no longer styled. e.g. the stylesheet is not
> > in the proper path and afaik there isn't anything telling the app
> > where to find it. :-/
>
> > Next step.
>
> > * 5. Protect the transfer directory
>
> > ../cake/console/cake media protect
>
> > Doesn't work. I just get the message: The content of the transfer
> > directory is not served. Guess I'll create this one manually as well.
>
> > nano transfer/.htaccess
>
> > Order deny,allow
> > Deny from all
>
> > Save and exit.
>
> > 6. Give up.
>
> > Actually I pressed on but there really isn't any thorough
> > documentation after this point.
>
> > Any help would be appreciated. I'd love to put together some
> > documentation that would help other n00bs like me get this thing set
> > up.

--
Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions.
 
 
To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php

No comments: