You are here

function _linkimagefield_preview in Link Image Field 5

transfer a file that is in a 'preview' state. @todo multiple support

1 string reference to '_linkimagefield_preview'
linkimagefield_menu in ./linkimagefield.module

File

./linkimagefield.module, line 47
Defines an link image field type. linkimagefield uses content.module to store the fid, and the drupal files table to store the actual file data.

Code

function _linkimagefield_preview() {
  foreach ($_SESSION['linkimagefield'] as $fieldname => $files) {
    foreach ($files as $delta => $file) {
      if ($file['preview'] == $_GET['q']) {
        file_transfer($file['filepath'], array(
          'Content-Type: ' . mime_header_encode($file['filemime']),
          'Content-Length: ' . $file['filesize'],
        ));
        exit;
      }
    }
  }
}