Files and Thumbnails

Files are stored in $pnFileFolder.
$forms->pnFileFolder = “./upload”;

addThumb() causes a thumbnail to be created for an attribute. Multiple thumbnails can be created for each attribute. This first thumbnail will be show in the edit/insert form. The last thumbnail will be shown in the list.

Parameters:

  • name: name of the database attribute
  • width: thumbnail width in pixel
  • height: thumbnail height in pixel
  • [max]: if false, width and height are minimum dimensions

Files can be accessed even if $pnFileFolder is protected by .htaccess. If you need to ensure access restrictions and if you plan to send headers before calling build() or doit(), call sendFile() manually after setting the pnRestrictSql variable. If you send headers after calling build() or doit(), sending files works fine by default.

Sample (headers sent):

$form = new PNFormTrash();
$form->pnRestrictSql = ” AND user = 12 “;
$form->sendFile();
echo “…”;
echo $forms->doit();
..

Sample (headers not sent):

$form = new PNFormTrash();
$form->pnRestrictSql = ” AND user = 12 “;
$html = $forms->doit();
echo “…”;
echo $html;

Sample Code

Live Sample