duration() public méthode

public duration ( string $t ) : object
$t string Stop writing the output after its duration reaches duration. duration may be a number in seconds, or in hh:mm:ss[.xxx] form. @return object @access public
Résultat object
 function _before()
 {
     if (!preg_match('~^https?://~', $this->filename)) {
         $this->file_type = (int) $this->set_type();
         $path = $this->path_to_original();
         $pathinfo = pathinfo($path);
         if ($this->file_type > 0) {
             include_once FCPATH . 'app' . DIRECTORY_SEPARATOR . 'koken' . DIRECTORY_SEPARATOR . 'ffmpeg.php';
             $ffmpeg = new FFmpeg($path);
             if ($ffmpeg->version()) {
                 $this->duration = $ffmpeg->duration();
                 list($this->width, $this->height) = $ffmpeg->dimensions();
                 $this->lg_preview = $ffmpeg->create_thumbs();
             }
         } else {
             list($this->width, $this->height) = getimagesize($path);
             @unlink($path . '.icc');
             $iptc = $this->_get_iptc_data($path);
             $this->has_iptc = !empty($iptc);
             $exif = $this->_get_exif_data($path);
             $this->has_exif = !empty($exif);
             if (isset($iptc['2#005'])) {
                 if (is_array($iptc['2#005'])) {
                     $iptc['2#005'] = $iptc['2#005'][0];
                 }
                 $this->title = $this->_force_utf($iptc['2#005']);
             }
             if (isset($iptc['2#120'])) {
                 if (is_array($iptc['2#120'])) {
                     $iptc['2#120'] = $iptc['2#120'][0];
                 }
                 $this->caption = $this->_force_utf($iptc['2#120']);
             }
             if (isset($iptc['2#025']) && is_array($iptc['2#025'])) {
                 $words = array();
                 if (count($iptc['2#025']) == 1) {
                     $words = array($iptc['2#025'][0]);
                 } else {
                     $words = $iptc['2#025'];
                 }
                 $_POST['tags'] = rtrim($_POST['tags'], ',') . ',' . join(',', $words);
             }
             $captured_on = $this->parse_captured($iptc, $exif);
             if (!is_null($captured_on) && $captured_on > 0) {
                 $this->captured_on = $captured_on;
             }
             $longest = max($this->width, $this->height);
             $midsize = preg_replace('/\\.' . $pathinfo['extension'] . '$/', '.1600.' . $pathinfo['extension'], $path);
             if (file_exists($midsize)) {
                 unlink($midsize);
             }
             if ($longest > 1600) {
                 include_once FCPATH . 'app' . DIRECTORY_SEPARATOR . 'koken' . DIRECTORY_SEPARATOR . 'DarkroomUtils.php';
                 $s = new Setting();
                 $s->where('name', 'image_processing_library')->get();
                 $d = DarkroomUtils::init($s->value);
                 $d->read($path, $this->width, $this->height)->resize(1600)->quality(100)->render($midsize);
                 $external = Shutter::store_original($midsize, $this->path . '/' . basename($midsize));
                 if ($external) {
                     $this->storage_url_midsize = $external;
                     unlink($midsize);
                 }
             }
         }
         $this->filesize = filesize($path);
     }
     if (is_numeric($this->width)) {
         $this->aspect_ratio = $this->width / $this->height;
     }
 }