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 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 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
Re: Media Plugin - Getting Started
Hi David - will the documentation be updated soon? I'd really like to integrate this for a project.. Cheers On Jul 9, 9:01 pm, David Persson wrote: > The current documentation in themediapluginwiki isn't yet updated > to match with the upcoming 1.3 version of theplugin. The new version > will relax and (hopefully) simplify the expected directory structure. > All support for assets (css and js) is going to be removed and moved > back into the hands of the FW itself. The initial idea of theplugin > was to deal with all kinds ofmediafiles including treating assets > asmediafiles. This turned out to be a bit "overdone" so this support is > removed from theplugin. I know that setting up theplugincan be a > bit hard in the first place, but the topic needs a bit understanding > as it may become critical to your app. When I'm updating the docs for > 1.3 I'll be keeping that in mind. If you've got any suggestion or > wan't to write up a quick "how to get started" page just add one to > thepluginwiki. > > - David > > On 5 Jul., 19:30, dbme wrote: > > > > > > > > > I'm just getting started with CakePHP and also David Persson'sMedia > >plugin(http://github.com/davidpersson/media). I've got my app working > > but I'm having a difficult time getting theMediapluginworking. 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 theMediapluginconfig 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/cakemediainit > > > 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 themediainto the new location > > > ../cake/console/cakemediacollect > > > But this results in a bunch of errors :( > > > > >MediaShell > > > > 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/cakemediaprotect > > > 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 w
Re: Media Plugin - Getting Started
David, thanks for all the hard work, it is a great contribution! On Jul 9, 9:01 am, David Persson wrote: > The current documentation in the media plugin wiki isn't yet updated > to match with the upcoming 1.3 version of the plugin. The new version > will relax and (hopefully) simplify the expected directory structure. > All support for assets (css and js) is going to be removed and moved > back into the hands of the FW itself. The initial idea of the plugin > was to deal with all kinds of media files including treating assets as > media files. This turned out to be a bit "overdone" so this support is > removed from the plugin. I know that setting up the plugin can be a > bit hard in the first place, but the topic needs a bit understanding > as it may become critical to your app. When I'm updating the docs for > 1.3 I'll be keeping that in mind. If you've got any suggestion or > wan't to write up a quick "how to get started" page just add one to > the plugin wiki. > > - David > > On 5 Jul., 19:30, dbme wrote: > > > I'm just getting started with CakePHP and also DavidPersson'sMedia > > 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 l
Re: Media Plugin - Getting Started
The current documentation in the media plugin wiki isn't yet updated to match with the upcoming 1.3 version of the plugin. The new version will relax and (hopefully) simplify the expected directory structure. All support for assets (css and js) is going to be removed and moved back into the hands of the FW itself. The initial idea of the plugin was to deal with all kinds of media files including treating assets as media files. This turned out to be a bit "overdone" so this support is removed from the plugin. I know that setting up the plugin can be a bit hard in the first place, but the topic needs a bit understanding as it may become critical to your app. When I'm updating the docs for 1.3 I'll be keeping that in mind. If you've got any suggestion or wan't to write up a quick "how to get started" page just add one to the plugin wiki. - David On 5 Jul., 19:30, dbme 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. 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 G
Re: Media Plugin - Getting Started
Hi Marco, It looks like you're using the current stable version of the plugin, which is totally fine. If you're plans allow you may also want to try the upcoming version which you'll find in the "1.3" branch of the repo. It doesn't have any documentation so you may be better off working with the stable one though. Now to your question: You can't use the Model.id for generating the destination path of the uploaded file, because the path is generated *before* the file is saved. Hope this helps, - David On 9 Jul., 10:08, "marco.rizze...@gmail.com" wrote: > Hi > I would ask another question about media plugin: > > In my attachment model I have this configuration for Media.Transfer: > > 'Media.Transfer' => array( > 'trustClient' => false, > 'destinationFile' => > ':Medium.short::DS:attachments:DS::Model.id::DS:attachment.:Source.extension:', > 'baseDirectory' => MEDIA_TRANSFER, > 'createDirectory' => true, > 'alternativeFile' => 100 > ), > > The problem is the marker Model.id when I add a NEW attachment , > because the marker have no vlaue infact I get this error : > > " > TransferBehavior::_replaceMarker - Failed to replace all markers of > subject `img\attachments\unknown_marker\attachment.jpg`. Did you setup > the behavior correctly? Check the configuration you provided for > TransferBehavior in your `Attachment` model. > [APP\plugins\media\models\behaviors\transfer.php, line 840 > " > > I would know if is it possible to use field of Model to config > destinationFile? > > Many Thanks > Marco > > On 7 Lug, 07:01, randy wrote: > > > Quick reply to answer your questions... > > > My directory structure is like the first one, with app/webroot/ > > transfer instead of app/webroot/media/transfer. > > > I'd like to not serve EVERYmediafile from theplugin, so I'm going > > to do what I can to not pull my CSS into that directory structure. > > So...my styles are still being applied. > > > I'll gladly share my code and show what I'm doing, but I first will > > need to get stuff working. > > > Still working on the UUID filenaming issue, but out-of-the-box it > > looks like it will NOT overwrite existing files. > > > I'm also trying to figure out how to config the metadata stuff, I had > > this working before, but am unable to restore that functionality. I > > swear I saw this in the documentation but am not able to track down > > this bit. If you can point me in the right direction it would be > > appreciated. > > > On Jul 6, 10:26 pm, dbme wrote: > > > > 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 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 theMediaHelper 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 wrote: > > > > > > I'm just getting started with CakePHP and also David Persson'sMedia > > > > >plugin(http://github.com/davidpersson/media). I've got my app working > > > > > but I'm having a difficult time getting theMediapluginworking. 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 theMe
Re: Media Plugin - Getting Started
Hi I would ask another question about media plugin: In my attachment model I have this configuration for Media.Transfer: 'Media.Transfer' => array( 'trustClient' => false, 'destinationFile' => ':Medium.short::DS:attachments:DS::Model.id::DS:attachment.:Source.extension:', 'baseDirectory' => MEDIA_TRANSFER, 'createDirectory' => true, 'alternativeFile' => 100 ), The problem is the marker Model.id when I add a NEW attachment , because the marker have no vlaue infact I get this error : " TransferBehavior::_replaceMarker - Failed to replace all markers of subject `img\attachments\unknown_marker\attachment.jpg`. Did you setup the behavior correctly? Check the configuration you provided for TransferBehavior in your `Attachment` model. [APP\plugins\media\models\behaviors\transfer.php, line 840 " I would know if is it possible to use field of Model to config destinationFile? Many Thanks Marco On 7 Lug, 07:01, randy wrote: > Quick reply to answer your questions... > > My directory structure is like the first one, with app/webroot/ > transfer instead of app/webroot/media/transfer. > > I'd like to not serve EVERYmediafile from theplugin, so I'm going > to do what I can to not pull my CSS into that directory structure. > So...my styles are still being applied. > > I'll gladly share my code and show what I'm doing, but I first will > need to get stuff working. > > Still working on the UUID filenaming issue, but out-of-the-box it > looks like it will NOT overwrite existing files. > > I'm also trying to figure out how to config the metadata stuff, I had > this working before, but am unable to restore that functionality. I > swear I saw this in the documentation but am not able to track down > this bit. If you can point me in the right direction it would be > appreciated. > > On Jul 6, 10:26 pm, dbme wrote: > > > 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 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 theMediaHelper 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 wrote: > > > > > I'm just getting started with CakePHP and also David Persson'sMedia > > > >plugin(http://github.com/davidpersson/media). I've got my app working > > > > but I'm having a difficult time getting theMediapluginworking. 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 theMediapluginconfig 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/cakemediainit > > > > > 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 themed
Re: Media Plugin - Getting Started
Quick reply to answer your questions... My directory structure is like the first one, with app/webroot/ transfer instead of app/webroot/media/transfer. I'd like to not serve EVERY media file from the plugin, so I'm going to do what I can to not pull my CSS into that directory structure. So...my styles are still being applied. I'll gladly share my code and show what I'm doing, but I first will need to get stuff working. Still working on the UUID filenaming issue, but out-of-the-box it looks like it will NOT overwrite existing files. I'm also trying to figure out how to config the metadata stuff, I had this working before, but am unable to restore that functionality. I swear I saw this in the documentation but am not able to track down this bit. If you can point me in the right direction it would be appreciated. On Jul 6, 10:26 pm, dbme wrote: > 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 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 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_
Re: Media Plugin - Getting Started
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 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 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
Re: Media Plugin - Getting Started
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 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. Check out the new CakePHP Questions site http://cakeqs.org and
Media Plugin - Getting Started
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. 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