function template_preprocess_comment_upload_attachments in Comment Upload 6
File
- ./
comment_upload.module, line 685 - Provides file attachment functionality for comments.
Code
function template_preprocess_comment_upload_attachments(&$variables) {
$row = 0;
$variables['images'] = array();
$variables['attachments'] = array();
foreach ($variables['files'] as $fid => $file) {
if ($file['list'] && empty($file['remove'])) {
$text = $file['description'] ? $file['description'] : $file['filename'];
if ($variables['display_images'] && strpos($file['filemime'], 'image/') === 0) {
if ($variables['preset']) {
$variables['images'][$fid]['image'] = theme('imagecache', $variables['preset'], file_create_path($file['filepath']), $text, $text);
}
else {
$variables['images'][$fid]['image'] = theme('image', file_create_path($file['filepath']), $text, $text);
}
$variables['images'][$fid]['url'] = check_url(file_create_url($file['filepath']));
}
else {
$variables['attachments'][$fid]['zebra'] = $row % 2 == 0 ? 'odd' : 'even';
$variables['attachments'][$fid]['text'] = check_plain($text);
$variables['attachments'][$fid]['url'] = check_url(file_create_url($file['filepath']));
$variables['attachments'][$fid]['size'] = format_size($file['filesize']);
$row++;
}
}
}
}