You are here

function _imagefield_preview in ImageField 5

Same name and namespace in other branches
  1. 5.2 imagefield.module \_imagefield_preview()

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

1 string reference to '_imagefield_preview'
imagefield_menu in ./imagefield.module

File

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

Code

function _imagefield_preview() {
  foreach ($_SESSION['imagefield'] 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;
      }
    }
  }
}