Changeset 16319


Ignore:
Timestamp:
Jul 3, 2012, 3:49:46 PM (12 years ago)
Author:
plg
Message:

better management on GVideo videos

File:
1 edited

Legend:

Unmodified
Added
Removed
  • extensions/virtualize/admin.php

    r9562 r16319  
    7777    secure_directory($upload_dir);
    7878
    79     $newfilename = $year.$month.$day.$hour.$minute.$second.'-'.substr($md5sum, 0, 8).'.jpg';
     79    $extension = get_extension($row['oldpath']);
     80    if (in_array($extension, array('vimeo', 'ytube', 'dm')))
     81    {
     82      $newfilename = basename($row['oldpath']);
     83    }
     84    else
     85    {
     86      $newfilename = $year.$month.$day.$hour.$minute.$second.'-'.substr($md5sum, 0, 8).'.jpg';
     87    }
    8088
    8189    $newpath = $upload_dir.'/'.$newfilename;
     
    114122
    115123    # thumbnail
    116     $tn_dir = $upload_dir.'/thumbnail';
    117 
    118     if (!is_dir($tn_dir))
     124    if (!empty($row['tn_ext']))
    119125    {
    120       umask(0000);
    121       $recursive = true;
    122       if (!@mkdir($tn_dir, 0777, $recursive))
     126      $tn_dir = $upload_dir.'/thumbnail';
     127     
     128      if (!is_dir($tn_dir))
    123129      {
    124         echo 'error during "'.$tn_dir.'" directory creation';
    125         exit();
     130        umask(0000);
     131        $recursive = true;
     132        if (!@mkdir($tn_dir, 0777, $recursive))
     133        {
     134          echo 'error during "'.$tn_dir.'" directory creation';
     135          exit();
     136        }
    126137      }
     138     
     139      $tn_oldname = $conf['prefix_thumbnail'];
     140      $tn_oldname.= get_filename_wo_extension(basename($row['oldpath']));
     141      $tn_oldname.= '.'.$row['tn_ext'];
     142     
     143      rename(
     144        dirname($row['oldpath']).'/thumbnail/'.$tn_oldname,
     145        $tn_dir.'/'.$conf['prefix_thumbnail'].get_filename_wo_extension(basename($newfilename)).'.jpg'
     146        );
    127147    }
    128 
    129     $tn_oldname = $conf['prefix_thumbnail'];
    130     $tn_oldname.= get_filename_wo_extension(basename($row['oldpath']));
    131     $tn_oldname.= '.'.$row['tn_ext'];
    132    
    133     rename(
    134       dirname($row['oldpath']).'/thumbnail/'.$tn_oldname,
    135       $tn_dir.'/'.$conf['prefix_thumbnail'].$newfilename
    136       );
    137    
    138148    // break;
    139149  }
Note: See TracChangeset for help on using the changeset viewer.