Hello.

I an looking through the upload.module file and I can't find out where I could put the code to ad an image above the Atached Files in my stories and pages. Could someone give me a hand? Thanks!

Comments

pwolanin’s picture

You want the same image above every upload?

Try overriding this function in your theme (don't change the code in the module):

http://api.drupal.org/api/4.7/function/theme_upload_attachments

see:

http://drupal.org/node/11811

---
Work: BioRAFT

mrjw’s picture

So far I got this in my template.php

function blue_mark_upload_attachments($files) {
  $header = array(t('Attachment'), t('Size'));
  $rows = array();
  foreach ($files as $file) {
    if ($file->list) {
      $href = $file->fid ? file_create_url($file->filepath) : url(file_create_filename($file->filename, file_create_path()));
      $text = $file->description ? $file->description : $file->filename;
      $rows[] = array(l($text, $href), format_size($file->filesize));
    }
  }
  if (count($rows)) {
    return theme('table', $header, $rows, array('id' => 'attachments'));
  }
} 

But I don't see how I can add an image above the story's attached file box? Help please

pwolanin’s picture

function blue_mark_upload_attachments($files) {
  $header = array(t('Attachment'), t('Size'));
  $rows = array();
  foreach ($files as $file) {
    if ($file->list) {
      $href = $file->fid ? file_create_url($file->filepath) : url(file_create_filename($file->filename, file_create_path()));
      $text = $file->description ? $file->description : $file->filename;
      $rows[] = array(l($text, $href), format_size($file->filesize));
    }
  }
  if (count($rows)) {
     $output = '<img src="myimage.jpg"><br class="clear">';
     $output .= theme('table', $header, $rows, array('id' => 'attachments'));
     return $output;
  }
}

---
Work: BioRAFT

mr.alinaki’s picture

Hi! I have the same problem, but I want to place unique image on every file I've uploaded (or if file already on server). How I can do this? Is it possible?
Thanks!

pwolanin’s picture

mr.alinaki’s picture

Thanks, but, as I understand, this module shows users thumbnail of the picture they are uploading and its name. But I need to attach the picture to any file. I am considering the video module midification, but I am short of time