plugins/gallery/fetcher.php
changeset 27 3d8ec1f7d191
parent 26 023a21c8f47c
child 28 36ea553da7ba
equal deleted inserted replaced
26:023a21c8f47c 27:3d8ec1f7d191
    90     case 'embed':
    90     case 'embed':
    91       if ( !isset($_GET['width']) || !isset($_GET['height']) )
    91       if ( !isset($_GET['width']) || !isset($_GET['height']) )
    92       {
    92       {
    93         die('Missing width or height.');
    93         die('Missing width or height.');
    94       }
    94       }
    95       $src_filename  = ENANO_ROOT . '/files/' . $row['img_filename'];
       
    96       $dest_filename = ENANO_ROOT . '/cache/' . $row['img_filename'] . "-embed-$width-$height.$ext";
       
    97       $filename =& $dest_filename;
       
    98       $ext = get_file_extension($filename);
       
    99       
       
   100       $width = intval($_GET['width']);
    95       $width = intval($_GET['width']);
   101       $height = intval($_GET['height']);
    96       $height = intval($_GET['height']);
   102       if ( empty($width) || empty($height) || $width > 2048 || $height > 2048 )
    97       if ( empty($width) || empty($height) || $width > 2048 || $height > 2048 )
   103       {
    98       {
   104         die('Bad width or height');
    99         die('Bad width or height');
   105       }
   100       }
       
   101       
       
   102       $src_filename  = ENANO_ROOT . '/files/' . $row['img_filename'];
       
   103       $dest_filename = ENANO_ROOT . '/cache/' . $row['img_filename'] . "-embed-$width-$height.$ext";
       
   104       $filename =& $dest_filename;
       
   105       $ext = get_file_extension($filename);
   106       
   106       
   107       if ( !file_exists($dest_filename) )
   107       if ( !file_exists($dest_filename) )
   108       {
   108       {
   109         if ( !scale_image($src_filename, $dest_filename, $width, $height, false) )
   109         if ( !scale_image($src_filename, $dest_filename, $width, $height, false) )
   110         {
   110         {