예제 #1
0
  public static function summary( MEOW_Field $field ) {

    $filename = "";
    $filesize = "";
    $filetype = "";
    $filename_trunc = "";
    $filetype_trunc = "";


    if (!$field->blank()) {
      $file = $field->file();

      if ($file && $file->exists()) {

        $filename = $file->basename();
        $filesize = $file->filesize();
        $filetype = $file->filetype();

        $filename_trunc = WOOF::truncate_advanced($filename, 26, $etc = ' … ', false, true);
        $filetype_trunc = WOOF::truncate_advanced($filetype, 25, $etc = ' … ', false, true);

      }
    }

    $html = <<<HTML

    <div class="summary">
      <span class="name" title="{$filename}">{$filename_trunc}</span>
      <span class="type-size"><span class="type" title="{$filetype}">{$filetype_trunc}</span>
      <br><span class="size">{$filesize}</span></span>
    </div>

HTML;

    return $html;

  }
예제 #2
0
  public static function summary( MEOW_Field $field ) {

    global $wf;

    $image = "";
    
    list($stw, $sth) = array(82, 39);

    $no_image = __("( no image )", MASTERPRESS_DOMAIN);

    $empty = "empty";
    $thumb = WOOF_Image::empty_mp_thumb(array("w" => $stw, "h" => $sth, "no_image" => $no_image, "class" => "summary-thumb") );
    
    if (!$field->blank()) {
      $image = $field->file();

      if ($image && $image->exists()) {
        $width = $image->width();
        $height = $image->height();

        list($stw, $sth) = self::summary_thumb_wh($width, $height);
        
        $thumb = $image->mp_thumb(array("w" => $stw, "h" => $sth, "no_image" => $no_image, "thumb_only" => true, "class" => "summary-thumb"));

      }
    }

    $html = $thumb;

    return $html;

  }