Image uploads - count + display

3 posts by 2 authors in: Forums > CMS Builder
Last Post: May 28, 2013   (RSS)

By Daryl - May 28, 2013 - edited: May 28, 2013

Hi Deborah,

All the uploaded files are stored in the  "uploads" table and is associated by its "tableName" and "recordNum" fields with all of the other tables' table name and "num" field of its record.

Example:


$getImageCount = count(mysql_select('uploads', array('tableName' => 'products', 'recordNum' => '1')));
echo $getImageCount;
// wherein 'recordNum' => '1', '1' is the 'num' field of a record inside the 'products' table

Or if you're using the getRecords function, the uploads data are stored in ['images'] field: 

  // load records from 'products'
  list($productsRecords, $productsMetaData) = getRecords(array(
    'tableName'   => 'products',
    'loadUploads' => true,
    'allowSearch' => false,
  ));
  
  foreach ($productsRecords as $record){
    echo count($record['images']);
  }

Hope this helps!

Regards,

Daryl

Daryl Maximo
PHP Programmer - interactivetools.com

By Deborah - May 28, 2013

Daryl, I appreciate your reply. I'll work with this and see how it goes with my setup.

Thanks so much!
~ Deborah