Changeset 3248 for libcaca


Ignore:
Timestamp:
Nov 3, 2008, 10:17:34 PM (11 years ago)
Author:
bsittler
Message:

suggest extensions for some of the inline formats too, since browsers
sometimes send them to external viewers and become confused if the
filename ends in '.php' (despite our correct content-type!)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • libcaca/trunk/caca-php/examples/www/export.php

    r3247 r3248  
    150150        );
    151151
    152 $extension_map = array(
     152$download_extension_map = array(
    153153        'ansi' => 'txt',
    154154        'utf8' => 'txt',
     
    156156        'irc' => 'txt',
    157157        'tga' => 'tga'
     158        );
     159
     160$inline_extension_map = array(
     161        'bbfr' => 'txt',
     162        'ps' => 'ps',
     163        'svg' => 'svg'
    158164        );
    159165
     
    164170
    165171header('Content-Type: ' . $content_type);
    166 if (array_key_exists($format, $extension_map))
    167         header('Content-Disposition: attachment; filename=export.' . $extension_map[$format]);
     172if (array_key_exists($format, $download_extension_map))
     173        header('Content-Disposition: attachment; filename=export.' . $download_extension_map[$format]);
     174else if (array_key_exists($format, $inline_extension_map))
     175        header('Content-Disposition: inline; filename=export.' . $inline_extension_map[$format]);
    168176
    169177echo caca_export_string($cv, $format);
Note: See TracChangeset for help on using the changeset viewer.