Have a question about CiviCRM? Get it answered quickly at the new CiviCRM Stack Exchange Q+A siteThis forum was archived on 25 November 2017. Learn more.How to get involved.What to do if you think you've found a bug.
$files = crm_get_file(array('id'=>$id));
you might want to try to use civicrm_file_get( $params ) instead of crm_get_file( );here is the related document for file api's http://wiki.civicrm.org/confluence/display/CRMDOC33/File+APIshope this helpkiran
<?php $image_uri = url(get_civicrm_image($fields['image-2']->content)); ?><img src="<?php echo $image_uri; ?>" />
function get_civicrm_image($id, $dimensions=array(200,200)) { civicrm_initialize(); require_once('api/v2/File.php'); // get the file details $files = civicrm_file_get(array('id'=>$id)); $file = array_shift($files); $filename = $file['uri']; $root = $_SERVER['DOCUMENT_ROOT']; $file_ext = strrchr($filename, '.'); $file_base = substr($filename, 0, 0 - strlen($file_ext)); $old_path = $root . '/' . file_directory_path() . '/civicrm/custom/' . $filename; $new_file = file_directory_path() . '/civicrm/custom/' . $file_base . '_' . $dimensions[0] . 'x' . $dimensions[1] . $file_ext; if(!file_exists($root . '/' . $new_file)) { image_scale_and_crop($old_path, $root . '/' . $new_file, $dimensions[0], $dimensions[1]); } return $new_file;}
warning: Division by zero in /home/politi33/public_html/afceasiliconbayou.org/includes/image.inc on line 160.