Development

Changeset 18961

You must first sign up to be able to contribute.

Changeset 18961

Show
Ignore:
Timestamp:
06/05/09 16:14:16 (4 years ago)
Author:
boutell
Message:

User-contributed fix so that image-preview is not always turned on regardless of the actual option setting
passed in. Also, documentation of how to use that option, and the requirement for pkImageConverterPlugin if
you wish to use it.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • plugins/pkPersistentFileUploadPlugin/trunk/README

    r17920 r18961  
    3737* pkToolkitPlugin 
    3838 
     39And, optionally: 
     40 
     41* pkImageConverterPlugin 
     42 
     43If you wish to enable the image-preview option while adding the widget, which displays a thumbnail  
     44of  successfully uploaded image files while the user completes additional validation passes 
     45over the form. 
     46 
    3947That's it. You do not need to use any particular ORM 
    4048because the persistent cache of file uploads is implemented via the filesystem. 
     
    4250## Installation 
    4351 
    44     Newly uploaded files are copied to a subfolder of your project's 
    45     `data` folder called `pk-writable`, which is created for you 
    46     if it does not already exist. Note that if the permissions of your 
    47     `data` folder do not permit this, you'll need to manually create the 
    48     `data/pk-writable` folder and make sure it is readable, writable and  
    49     executable by the web server. Creating this one folder will take care 
    50     of the non-database data storage needs of all P'unk Avenue plugins. 
    51  
    52     Note that 777 permissions are only appropriate when your web server 
    53     runs as a user who otherwise can't touch any files (but this is 
    54     standard practice with many hosting setups): 
     52Newly uploaded files are copied to a subfolder of your project's 
     53`data` folder called `pk-writable`, which is created for you 
     54if it does not already exist. Note that if the permissions of your 
     55`data` folder do not permit this, you'll need to manually create the 
     56`data/pk-writable` folder and make sure it is readable, writable and  
     57executable by the web server. Creating this one folder will take care 
     58of the non-database data storage needs of all P'unk Avenue plugins. 
     59 
     60Note that 777 permissions are only appropriate when your web server 
     61runs as a user who otherwise can't touch any files (but this is 
     62standard practice with many hosting setups): 
    5563 
    5664    mkdir data/pk-writable 
    5765    chmod 777 data/pk-writable 
     66 
     67If you are using the image-preview feature, a `web/uploads/uploaded_image_preview` 
     68will be automatically created to hold the previews, which are automatically aged off 
     69as needed, just as the persistent upload folder's contents are. 
    5870 
    5971## Usage 
     
    6476    $this->setWidget('file', new pkWidgetFormInputFilePersistent()); 
    6577    $this->setValidator('file', new pkValidatorFilePersistent( 
    66       array("mime_types" => array("image/jpeg")))); 
     78      array("mime_types" => array("image/jpeg"), 
     79        "image-preview" => true))); 
    6780 
    6881You can pass all of the usual options to both the widget and 
    6982the validator. This particular example accepts only JPEG images. 
     83 
     84Note that you should not enable the `image-preview` option unless you are expecting 
     85only image files. 
    7086 
    7187## Telling the User What's Going On 
  • plugins/pkPersistentFileUploadPlugin/trunk/lib/widget/pkWidgetFormInputFilePersistent.class.php

    r17536 r18961  
    6767    if ($exists) 
    6868    { 
    69       if ($this->hasOption('image-preview')) 
     69      // hasOption just verifies that the option is valid, it doesn't check what, 
     70      // if anything, was passed. Thanks to Lucjan Wilczewski  
     71      if ($this->hasOption('image-preview') && $this->getOption('image-preview')) 
    7072      { 
    7173        // Note change of key 
  • plugins/pkPersistentFileUploadPlugin/trunk/package.xml.tmpl

    r18703 r18961  
    7979    <release> 
    8080      <version> 
     81        <release>0.9.1</release> 
     82        <api>1.0.0</api> 
     83      </version> 
     84      <stability> 
     85        <release>beta</release> 
     86        <api>stable</api> 
     87      </stability> 
     88      <license uri="http://www.symfony-project.org/license">MIT license</license> 
     89      <date>2009-06-05</date> 
     90      <notes>image-preview option was turning on no matter what (thanks to Lucjan Wilczewski for finding this bug). Documentation now covers how to enable that option, and the need to install pkImageConverterPlugin if you want to use that option.</notes> 
     91    </release> 
     92    <release> 
     93      <version> 
    8194        <release>0.5.0</release> 
    8295        <api>1.0.0</api>