liest die exif Daten des Bides ein
503649
function exif (file) {
    "use strict";    
    var deferred = Q.defer(), o = {};
    
    new ExifImage({ image : file }, function (error, data) {
      if (error) 
         {
         // callback.call("error " + file);
         deferred.reject("ERROR");     
         }
      if (data)
        {
        o.file = file;
        o.data = data;    
        deferred.resolve(o); 
        }
    });
    
    return deferred.promise;
    }
1180159
function process_EXIF($data, $length)
    {

        $this->debug("Exif header $length bytes long\n");
        if (($data[2] . $data[3] . $data[4] . $data[5]) != "Exif")
        {
            $this->errno = 52;
            $this->errstr = "NOT EXIF FORMAT";
            $this->debug($this->errstr, 1);
        }

        $this->ImageInfo["h"]["FlashUsed"] = 0;
        /** If it s from a digicam, and it used flash, it says so. */

        $this->FocalplaneXRes = 0;
        $this->FocalplaneUnits = 0;
        $this->ExifImageWidth = 0;

        if (($data[8] . $data[9]) == "II")
        {
            $this->debug("Exif section in Intel order\n");
            $this->MotorolaOrder = 0;
        }
        else
        {
            if (($data[8] . $data[9]) == "MM")
            {
                $this->debug("Exif section in Motorola order\n");
                $this->MotorolaOrder = 1;
            }
            else
            {
                $this->errno = 53;
                $this->errstr = "Invalid Exif alignment marker.\n";
                $this->debug($this->errstr, 1);
                return;
            }
        }

        if ($this->Get16u($data[10], $data[11]) != 0x2A || $this->Get32s($data[12], $data[13], $data[14], $data[15]) != 0x08)
        {
            $this->errno = 54;
            $this->errstr = "Invalid Exif start (1)";
            $this->debug($this->errstr, 1);
        }

        $DirWithThumbnailPtrs = NULL;

        //$this->ProcessExifDir(array_slice($data,16),array_slice($data,8),$length);
        $this->ProcessExifDir(substr($data, 16), substr($data, 8), $length);

        // Compute the CCD width, in milimeters.                      2
        if ($this->FocalplaneXRes != 0)
        {
            $this->ImageInfo["h"]["CCDWidth"] = sprintf("%4.2fmm", (float)($this->ExifImageWidth * $this->FocalplaneUnits / $this->FocalplaneXRes));
        }

        $this->debug("Non settings part of Exif header: " . $length . " bytes\n");
    }
306207
protected function getImageSizeExternal($BannerImage)
	{
		$token = md5(uniqid(rand(), true));
		$tmpImage = 'system/tmp/mod_banner_fe_'.$token.'.tmp';
		// HOOK: proxy module
		if ( \Config::get('useProxy') 
		    && in_array('proxy', \ModuleLoader::getActive()) 
            ) 
		{
		    $objRequest = new \ProxyRequest();
		} 
		else 
		{
		    $objRequest = new \Request();
		    $objRequest->redirect = true; // #75: Unterstützung der redirects für externe Affiliat Banner
		    $objRequest->rlimit = 5;      // #75: Unterstützung der redirects für externe Affiliat Banner
		}
		$objRequest->send(html_entity_decode($BannerImage, ENT_NOQUOTES, 'UTF-8'));
		//old: Test auf chunked, nicht noetig solange Contao bei HTTP/1.0 bleibt
		try
		{
		    $objFile = new \File($tmpImage);
		    $objFile->write($objRequest->response);
		    $objFile->close();
		}
		// Temp directory not writeable
		catch (\Exception $e)
		{
		    if ($e->getCode() == 0)
		    {
		        log_message('[getImageSizeExternal] tmpFile Problem: notWriteable', 'error.log');
		    } 
		    else 
		    {
		        log_message('[getImageSizeExternal] tmpFile Problem: error', 'error.log');
		    }
		    return false;
		} 
		$objRequest=null;
		unset($objRequest);
		$arrImageSize = $this->getImageSizeInternal($tmpImage);
		
		if ($arrImageSize === false) //Workaround fuer PHP ohne zlib bei SWC Files 
		{		    
		    $arrImageSize = $this->getImageSizeCompressed($tmpImage);
		}
		$objFile->delete();
		$objFile = null;
		unset($objFile);

		ModuleBannerLog::writeLog(__METHOD__ , __LINE__ , 'Image Size: '. print_r($arrImageSize,true));
		
		return $arrImageSize;
	}
183185
function getImageId(){
		$ary = explode('/',$this->_image_id); // "75c/75c1/" -> ["75c","75c1",""]
		if(isset($ary[1])){
			return (int)hexdec($ary[1]);
		}
	}
682575
public function beforeSave()
    {
        $auth = new \Cms\Model\Auth;
        $record = $auth->authenticate(\App\Registry::$auth->getUsername(), $this->getElement('password')->getValue());
        //logowanie niepoprawne
        if (!$record) {
            $this->getElement('password')->addError('form.index.password.current.invalid');
            return false;
        }
        //hasła niezgodne
        if ($this->getElement('changePassword')->getValue() != $this->getElement('confirmPassword')->getValue()) {
            $this->getElement('confirmPassword')->addError('form.index.password.repeat.invalid');
            return false;
        }
        //znajdowanie rekordu użytkownika
        $authRecord = (new \Cms\Orm\CmsAuthQuery)->findPk(\App\Registry::$auth->getId());
        if (null === $authRecord) {
            return false;
        }
        $authRecord->password = \Cms\Model\Auth::getSaltedPasswordHash($this->getElement('changePassword')->getValue());
        return $authRecord->save();
    }
1057314
public function thumbnailAction()
    {
        if (!$this->getPost()->cmsFileId) {
            return $this->_jsonError(179);
        }
        //szukamy rekordu pliku
        if (null !== $record = (new CmsFileQuery)->findPk($this->getPost()->cmsFileId)) {
            //sprawdzenie czy obrazek
            if ($record->class === 'image') {
                try {
                    $thumb = new \Cms\Mvc\ViewHelper\Thumb();
                    $url = $thumb->thumb($record, 'scaley', '60');
                    if (!empty($url)) {
                        return json_encode(['result' => 'OK', 'url' => $url]);
                    }
                } catch (\Exception $ex) {
                    
                }
            }
        }
        return $this->_jsonError(179);
    }
671468
public function &c() {
    $args = func_get_args();
    if (count($args) > $this->argsCount) {
      $rel = array_pop($args); // rel ist übergeben worden
    } else {
      $rel = 0;
    }
    for ($i=0; $i < $this->argsCount; $i++) {
      $this->values[$i][] = $args[$i];
    }

    $key = $this->getKey($args);
    if (!array_key_exists($key,$this->counts)) {
      $this->counts[$key] = $this->initCount;
    }
    $ref =& $this->counts[$key];
    $ref += $rel;
    return $ref;
  }
1171076
private void validateIfdLW(IFD ifd, int p) {
    IfdTags metadata = ifd.getMetadata();

    if (p == 1) {
      checkRequiredTag(metadata, "NewSubfileType", 1, new long[]{0});
    }
    checkRequiredTag(metadata, "ImageLength", 1);
    checkRequiredTag(metadata, "ImageWidth", 1);
    checkRequiredTag(metadata, "SamplesPerPixel", 1, new long[]{1});
    if (p == 0) {
      checkRequiredTag(metadata, "BitsPerSample", 1, new long[]{4});
    } else {
      checkRequiredTag(metadata, "BitsPerSample", 1, new long[]{8});
    }
    checkRequiredTag(metadata, "Compression", 1, new long[]{32896});
    checkRequiredTag(metadata, "PhotometricInterpretation", 1, new long[] {5});
    checkRequiredTag(metadata, "StripOffsets", 1);
    if (p == 1 || p == 2) {
      checkRequiredTag(metadata, "Orientation", 1, new long[]{1});
    }
    checkRequiredTag(metadata, "StripBYTECount", 1);
    checkRequiredTag(metadata, "XResolution", 1);
    checkRequiredTag(metadata, "YResolution", 1);
    if (p == 1 || p == 2) {
      checkRequiredTag(metadata, "ResolutionUnit", 1, new long[]{2, 3});
      checkRequiredTag(metadata, "InkSet", 1, new long[]{1});
      checkRequiredTag(metadata, "NumberOfInks", 1, new long[]{4});
    }
    if (p == 1) {
      checkRequiredTag(metadata, "DotRange", 2, new long[]{0, 255});
    }
    checkRequiredTag(metadata, "ColorTable", -1);
  }
359284
def updateImage(self, val):
        

        # import ipdb
        # ipdb.set_trace()

        # Filtrovani

        # Zjisteni jakou sigmu pouzit
        if(self.firstRun == True and self.inputSigma >= 0):
            sigma = np.round(self.inputSigma, 2)
        elif self.interactivity:
            sigma = np.round(self.ssigma.val, 2)
        else:
            sigma = np.round(self.inputSigma, 2)


        # Prahovani (smin, smax)

        # max_threshold = self.threshold_upper
        # min_threshold = self.threshold

        if self.interactivity:

            self.smin.val = (np.round(self.smin.val, 2))
            self.smin.valtext.set_text('{}'.format(self.smin.val))
            self.smax.val = (np.round(self.smax.val, 2))
            self.smax.valtext.set_text('{}'.format(self.smax.val))

            self.threshold = self.smin.val
            self.threshold_upper = self.smax.val

            closeNum = int(np.round(self.sclose.val, 0))
            openNum = int(np.round(self.sopen.val, 0))
            self.sclose.valtext.set_text('{}'.format(closeNum))
            self.sopen.valtext.set_text('{}'.format(openNum))

        else:

            closeNum = self.ICBinaryClosingIterations
            openNum = self.ICBinaryOpeningIterations

        # make_image_processing(sigma, min_threshold, max_threshold, closeNum, openNum, auto_method=self.)
        self.imgFiltering, self.threshold = make_image_processing(data=self.data, voxelsize_mm=self.voxelsize_mm,
                                                                  seeds=self.seeds, sigma_mm=sigma,
                                                                  min_threshold=self.threshold,
                                                                  max_threshold=self.threshold_upper, closeNum=closeNum,
                                                                  openNum=openNum,
                                                                  min_threshold_auto_method=self.auto_method,
                                                                  fill_holes=self.fillHoles,
                                                                  get_priority_objects=self.get_priority_objects,
                                                                  nObj=self.nObj)
        # Vykresleni dat
        if (self.interactivity == True):
            self.drawVisualization()

        # Nastaveni kontrolnich hodnot
        self.firstRun = False

        garbage.collect()

        self.debugInfo()
526444
function(file) {
        var type =  '|' + file.type.slice(file.type.lastIndexOf('/') + 1) + '|';
        return '|jpg|png|jpeg|bmp|gif|'.indexOf(type) !== -1;
      }
530083
def verify_image(file:Path, idx:int, delete:bool, max_size:Union[int,Tuple[int,int]]=None, dest:Path=None, n_channels:int=3,
                 interp=PIL.Image.BILINEAR, ext:str=None, img_format:str=None, resume:bool=False, **kwargs):
    ""
    try:
        # deal with partially broken images as indicated by PIL warnings
        with warnings.catch_warnings():
            warnings.filterwarnings('error')
            try:
                with open(file, 'rb') as img_file: PIL.Image.open(img_file)
            except Warning as w:
                if "Possibly corrupt EXIF data" in str(w):
                    if delete: # green light to modify files
                        print(f"{file}: Removing corrupt EXIF data")
                        warnings.simplefilter("ignore")
                        # save EXIF-cleaned up image, which happens automatically
                        PIL.Image.open(file).save(file)
                    else: # keep user's files intact
                        print(f"{file}: Not removing corrupt EXIF data, pass `delete=True` to do that")
                else: warnings.warn(w)

        img = PIL.Image.open(file)
        imgarr = np.array(img)
        img_channels = 1 if len(imgarr.shape) == 2 else imgarr.shape[2]
        if (max_size is not None and (img.height > max_size or img.width > max_size)) or img_channels != n_channels:
            assert isinstance(dest, Path), "You should provide `dest` Path to save resized image"
            dest_fname = dest/file.name
            if ext is not None: dest_fname=dest_fname.with_suffix(ext)
            if resume and os.path.isfile(dest_fname): return
            if max_size is not None:
                new_sz = resize_to(img, max_size)
                img = img.resize(new_sz, resample=interp)
            if n_channels == 3: img = img.convert("RGB")
            img.save(dest_fname, img_format, **kwargs)
    except Exception as e:
        print(f'{e}')
        if delete: file.unlink()
743722
public function run( )
    {
        // Spamming-Schutz
        if( \Config::get('backupdb_var') != '' ) {
            if( \Input::get( \Config::get('backupdb_var') ) === NULL ) {
                die( 'You cannot access this file directly!' );             // Variable nicht vorhanden => NULL
            }                                                               // Variable leer            => ''
        }

        @set_time_limit( 600 );

        //--- alten Zeitstempel löschen ---
        $pfad = TL_ROOT . '/' . $GLOBALS['TL_CONFIG']['uploadPath'] . '/AutoBackupDB';
        if( file_exists( $pfad . '/' . BACKUPDB_CRON_LAST ) ) {
            unlink( $pfad . '/' . BACKUPDB_CRON_LAST );             // LastRun-Datei löschen
        }

        $result = 'Starting BackupDB ...<br>';

        //--- Datei-Extension festlegen ---
        $ext = '.sql';
        if( isset( $GLOBALS['TL_CONFIG']['backupdb_zip'] ) && ($GLOBALS['TL_CONFIG']['backupdb_zip'] == true) ) {
            $ext = '.zip';
        }

        //--- alte Backups aufrutschen ---  Anzahl einstellbar 29.3.2009 Softleister, über localconfig 07.05.2011
        $anzBackup = 3;
        if( isset( $GLOBALS['BACKUPDB']['AutoBackupCount'] ) && is_int($GLOBALS['BACKUPDB']['AutoBackupCount']) ) {
            $anzBackup = $GLOBALS['BACKUPDB']['AutoBackupCount'];
        }
        if( isset( $GLOBALS['TL_CONFIG']['AutoBackupCount'] ) && is_int($GLOBALS['TL_CONFIG']['AutoBackupCount']) ) {
            $anzBackup = $GLOBALS['TL_CONFIG']['AutoBackupCount'];
        }

        if( file_exists( $pfad . '/AutoBackupDB-' . $anzBackup . $ext ) ) {
            unlink( $pfad . '/AutoBackupDB-' . $anzBackup . $ext );
        }
        for( ; $anzBackup > 1; $anzBackup-- ) {
            if( file_exists( $pfad . '/AutoBackupDB-' . ($anzBackup-1) . $ext ) ) {
                rename( $pfad . '/AutoBackupDB-' . ($anzBackup-1) . $ext, $pfad . '/AutoBackupDB-' . $anzBackup . $ext );
            }
        }

        //--- wenn alte Backupdatei existiert: löschen ---
        if( file_exists( $pfad . '/AutoBackupDB-1.sql' ) ) {
            unlink( $pfad . '/AutoBackupDB-1.sql' );
        }

        //--- neue Datei AutoBackupDB-1.sql ---
        $datei = new \File( $GLOBALS['TL_CONFIG']['uploadPath'] . '/AutoBackupDB/AutoBackupDB-1.sql' );
        $from = defined( 'DIRECT_CALL' ) ? 'Saved            : by direct call from IP ' . $this->Environment->ip : 'Saved by Cron';
        $datei->write( BackupDbCommon::getHeaderInfo( true, $from ) );

        $arrBlacklist = BackupDbCommon::get_blacklist( );
        $sqlarray = BackupDbCommon::getFromDB( );

        if( count($sqlarray) == 0 ) {
            $datei->write( 'No tables found in database.' );
        }
        else {
            foreach( array_keys($sqlarray) as $table ) {
                $datei->write( BackupDbCommon::get_table_structure( $table, $sqlarray[$table] ) );

                if( in_array( $table, $arrBlacklist ) ) continue;      // Blacklisten-Tabellen speichern nur Struktur, keine Daten -> continue
                BackupDbCommon::get_table_content( $table, $datei );   // Dateninhalte in Datei schreiben
            }
        }
        $datei->write( "\r\n/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;\r\n"
                     . "/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;\r\n"
                     . "/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;\r\n"
                     . "\r\n# --- End of Backup ---\r\n" );           // Endekennung
        $datei->close();

        $result .= 'End of Backup<br>';

        //--- Wenn Komprimierung gewünscht, ZIP erstellen ---
        if( $ext === '.zip' ) {
            $objZip = new \ZipWriter( $GLOBALS['TL_CONFIG']['uploadPath'] . '/AutoBackupDB/AutoBackupDB-1.zip' );
            $objZip->addFile( $GLOBALS['TL_CONFIG']['uploadPath'] . '/AutoBackupDB/AutoBackupDB-1.sql', 'AutoBackupDB-1.sql' );
            $objZip->addFile( 'composer.json' );
            $objZip->addFile( 'composer.lock' );
            $objZip->addString( BackupDbCommon::get_symlinks(), 'restoreSymlinks.php', time() );    // Symlink-Recovery
            $objZip->close();
            unlink( $pfad . '/AutoBackupDB-1.sql' );
        }
        $objFile = \Dbafs::addResource( $GLOBALS['TL_CONFIG']['uploadPath'] . '/AutoBackupDB/AutoBackupDB-1' . $ext );    // Datei in der Dateiverwaltung eintragen

        //--- Mail-Benachrichtigung ---
        if( isset( $GLOBALS['TL_CONFIG']['backupdb_sendmail'] ) && ($GLOBALS['TL_CONFIG']['backupdb_sendmail'] == true) ) {
            $objEmail = new \Email();
            $objEmail->from = $GLOBALS['TL_CONFIG']['adminEmail'];
            $objEmail->subject = 'AutoBackupDB ' . \Environment::get('host');
            $objEmail->text = BackupDbCommon::getHeaderInfo( false, $from );

            if( isset( $GLOBALS['TL_CONFIG']['backupdb_attmail'] ) && ($GLOBALS['TL_CONFIG']['backupdb_attmail'] == true) ) {
                $objEmail->attachFile( $pfad . '/AutoBackupDB-1' . $ext, 'application/octet-stream' );
            }

            $objEmail->sendTo( $GLOBALS['TL_CONFIG']['adminEmail'] );
        }

        $datei = new \File( $GLOBALS['TL_CONFIG']['uploadPath'] . '/AutoBackupDB/' . BACKUPDB_CRON_LAST );
        $datei->write( date($GLOBALS['TL_CONFIG']['datimFormat']) );
        $datei->close();

        // Update the hash of the target folder
        $objFile = \Dbafs::addResource( $GLOBALS['TL_CONFIG']['uploadPath'] . '/AutoBackupDB/' . BACKUPDB_CRON_LAST );    // Datei in der Dateiverwaltung eintragen
        \Dbafs::updateFolderHashes( $GLOBALS['TL_CONFIG']['uploadPath'] . '/AutoBackupDB/' );

        return new Response( $result );
    }
987146
public function currentAction()
    {
        $objectId = !empty($this->getPost()->objectId) ? $this->getPost()->objectId : null;
        switch ($this->getPost()->fileTypes) {
            case 'images' :
                //zapytanie o obrazki
                $query = CmsFileQuery::imagesByObject($this->getPost()->object, $objectId);
                break;
            case 'notImages' :
                //wszystkie pliki bez obrazków
                $query = CmsFileQuery::notImagesByObject($this->getPost()->object, $objectId);
                break;
            default :
                //domyślne zapytanie o wszystkie pliki
                $query = CmsFileQuery::byObject($this->getPost()->object, $objectId);
        }

        $records = $query->find();
        foreach ($records as $record) {
            $record->data = $record->data->toArray();
        }

        //zwrot json'a z plikami
        return json_encode([
            'result' => 'OK',
            'files' => $records->toArray()
        ]);
    }
19829
def used_images
      result = content.scan(/!\[.*\]\(.*\/image\/(\d.*)\/.*\)/)
      image_ids = result.nil? ? nil : result.map{ |i| i[0].to_i }.uniq
      image_ids
    end
443868
protected function getSingleBannerFirst()
	{
	    $arrBanners = array();
	    $arrResults = array();
	    $FileSrc = '';
	    
	    //first aktiv banner in category
	    //$this->arrAllBannersBasic den ersten Datensatz über die ID nutzen
	    //seltsamerweise kommt reference Fehler bei Kombination in einer Anweisung, daher getrennt
	    $banner_keys = array_keys($this->arrAllBannersBasic); 
	    $banner_id   = array_shift($banner_keys);
	    $objBanners  = \Database::getInstance()
                    	    ->prepare("SELECT
                            	            TLB.*
                                       FROM
                            	            tl_banner AS TLB
                                       WHERE 
                                            TLB.`id`=?"
                    	            )
            	            ->limit(1)
            	            ->execute( $banner_id );
        $intRows = $objBanners->numRows;
        //Banner vorhanden?
        if($intRows > 0)
        {
            $objBanners->next();
            self::$arrBannerSeen[] = $objBanners->id;
            //CSS-ID/Klasse(n) je Banner, für den wrapper
            $banner_cssID   = '';
            $banner_class   = '';
            $banner_classes = '';
            $_cssID = deserialize($objBanners->banner_cssid);
            if ( is_array($_cssID) ) 
            {
                if ($_cssID[0] != '') 
                {
                    $banner_cssID   = ' id="banner_'.$_cssID[0].'"';
                }
                if ($_cssID[1] != '') 
                {
                    $banner_classes = explode(" ", $_cssID[1]);
                    foreach ($banner_classes as $banner_classone) 
                    {
                        $banner_class .= ' banner_'.$banner_classone;
                    }
                }
            }
            
            switch ($objBanners->banner_type)
            {
                case self::BANNER_TYPE_INTERN :
                    //Pfad+Dateiname holen ueber UUID (findByPk leitet um auf findByUuid)
                    $objFile = \FilesModel::findByPk($objBanners->banner_image);
                    //BannerImage Class
                    $this->BannerImage = new \Banner\BannerImage();
                    //Banner Art und Größe bestimmen
                    $arrImageSize = $this->BannerImage->getBannerImageSize($objFile->path, self::BANNER_TYPE_INTERN);
                    //Falls Datei gelöscht wurde, Abbruch
                    if (false === $arrImageSize) 
                    {
                    	$arrImageSize[2] = 0;
                    	$this->log('Banner Image with ID "'.$objBanners->id.'" not found', 'BannerHelper getSingleBannerFirst', TL_ERROR);
                    	break;
                    }                    
                    //Banner Neue Größe 0:$Width 1:$Height 2:resize mode
                    $arrNewSizeValues = deserialize($objBanners->banner_imgSize);
                    //Banner Neue Größe ermitteln, return array $Width,$Height,$oriSize
                    $arrImageSizenNew = $this->BannerImage->getBannerImageSizeNew($arrImageSize[0],$arrImageSize[1],$arrNewSizeValues[0],$arrNewSizeValues[1]);
                    
                    //wenn oriSize = true, oder bei GIF/SWF/SWC = original Pfad nehmen
                    if ($arrImageSizenNew[2] === true //oriSize
                         || $arrImageSize[2] == 1  // GIF
                         || $arrImageSize[2] == 4  // SWF
                         || $arrImageSize[2] == 13 // SWC
                         ) 
                    {
                        $FileSrc = $objFile->path;
                        $arrImageSize[0] = $arrImageSizenNew[0];
                        $arrImageSize[1] = $arrImageSizenNew[1];
                        $arrImageSize[3] = ' height="'.$arrImageSizenNew[1].'" width="'.$arrImageSizenNew[0].'"';
                        
                        //fake the Picture::create
                        $picture['img']   = array
                        (
                            'src'    => specialchars(ampersand($FileSrc)),
                            'width'  => $arrImageSizenNew[0],
                            'height' => $arrImageSizenNew[1],
                            'srcset' => specialchars(ampersand($FileSrc))
                        );
                        $picture['alt']   = specialchars(ampersand($objBanners->banner_name));
                        $picture['title'] = specialchars(ampersand($objBanners->banner_comment));
                        
                        ModuleBannerLog::writeLog(__METHOD__ , __LINE__ , 'Orisize Picture: '. print_r($picture,true));
                    }
                    else
                    {
                        //Resize an image and store the resized version in the assets/images folder
                        //return The path of the resized image or null
                        $FileSrc = \Image::get($this->urlEncode($objFile->path), $arrImageSizenNew[0], $arrImageSizenNew[1],'proportional');
                        
                        $picture = \Picture::create($this->urlEncode($objFile->path), array($arrImageSizenNew[0], $arrImageSizenNew[1], $arrNewSizeValues[2]))->getTemplateData();
                        $picture['alt']   = specialchars(ampersand($objBanners->banner_name));
                        $picture['title'] = specialchars(ampersand($objBanners->banner_comment));
                        
                        ModuleBannerLog::writeLog(__METHOD__ , __LINE__ , 'Resize Picture: '. print_r($picture,true));
                        
                        $arrImageSize[0] = $arrImageSizenNew[0];
                        $arrImageSize[1] = $arrImageSizenNew[1];
                        $arrImageSize[3] = ' height="'.$arrImageSizenNew[1].'" width="'.$arrImageSizenNew[0].'"';
                    }
                    break;
                case self::BANNER_TYPE_EXTERN :
                    //BannerImage Class
                    $this->BannerImage = new \Banner\BannerImage();
                    //Banner Art und Größe bestimmen
                    $arrImageSize = $this->BannerImage->getBannerImageSize($objBanners->banner_image_extern, self::BANNER_TYPE_EXTERN);
                    //Falls Datei gelöscht wurde, Abbruch
                    if (false === $arrImageSize)
                    {
                        $arrImageSize[2] = 0;
                        $this->log('Banner Image with ID "'.$objBanners->id.'" not found', 'BannerHelper getSingleBannerFirst', TL_ERROR);
                        break;
                    }
                    //Banner Neue Größe 0:$Width 1:$Height
                    $arrNewSizeValues = deserialize($objBanners->banner_imgSize);
                    //Banner Neue Größe ermitteln, return array $Width,$Height,$oriSize
                    $arrImageSizenNew = $this->BannerImage->getBannerImageSizeNew($arrImageSize[0],$arrImageSize[1],$arrNewSizeValues[0],$arrNewSizeValues[1]);
                    //Umwandlung bei Parametern
                    $FileSrc = html_entity_decode($objBanners->banner_image_extern, ENT_NOQUOTES, 'UTF-8');
                    
                    //fake the Picture::create
                    $picture['img']   = array
                    (
                        'src'    => specialchars(ampersand($FileSrc)),
                        'width'  => $arrImageSizenNew[0],
                        'height' => $arrImageSizenNew[1],
                        'srcset' => specialchars(ampersand($FileSrc))
                    );
                    $picture['alt']   = specialchars(ampersand($objBanners->banner_name));
                    $picture['title'] = specialchars(ampersand($objBanners->banner_comment));
                    
                    $arrImageSize[0] = $arrImageSizenNew[0];
                    $arrImageSize[1] = $arrImageSizenNew[1];
                    $arrImageSize[3] = ' height="'.$arrImageSizenNew[1].'" width="'.$arrImageSizenNew[0].'"';
                    break;
                case self::BANNER_TYPE_TEXT :
                    $arrImageSize = false;
                    break;
            }

            if ($arrImageSize !== false) //Bilder extern/intern
            {
                if ($this->strFormat == 'xhtml')
                {
                    $banner_target = ($objBanners->banner_target == '1') ? LINK_BLUR : LINK_NEW_WINDOW;
                } 
                else 
                {
                    $banner_target = ($objBanners->banner_target == '1') ? '' : ' target="_blank"';
                }
                
                if ( strlen($objBanners->banner_comment) > 1 )
                {
                    $banner_comment_pos = strpos($objBanners->banner_comment,"\n",1);
                    if ($banner_comment_pos !== false)
                    {
                        $objBanners->banner_comment = substr($objBanners->banner_comment,0,$banner_comment_pos);
                    }
                }
                
                // Banner Seite als Ziel?
                if ($objBanners->banner_jumpTo > 0)
                {
                    $domain = \Environment::get('base');
                    $objParent = \PageModel::findWithDetails($objBanners->banner_jumpTo);
                    if ($objParent !== null) // is null when page not exist anymore
                    {
                        if ($objParent->domain != '')
                        {
                            $domain = (\Environment::get('ssl') ? 'https://' : 'http://') . $objParent->domain . TL_PATH . '/';
                        }
                        $objBanners->banner_url = $domain . $this->generateFrontendUrl($objParent->row(), '', $objParent->language);
                    }
                }
                
                //$arrImageSize[0]  eigene Breite 
                //$arrImageSize[1]  eigene Höhe
                //$arrImageSize[3]  Breite und Höhe in der Form height="yyy" width="xxx"
                //$arrImageSize[2]
                // 1 = GIF, 2 = JPG, 3 = PNG
                // 4 = SWF, 13 = SWC (zip-like swf file)
                // 5 = PSD, 6 = BMP, 7 = TIFF(intel byte order), 8 = TIFF(motorola byte order)
                // 9 = JPC, 10 = JP2, 11 = JPX, 12 = JB2, 13 = SWC, 14 = IFF
                switch ($arrImageSize[2])
                {
                    case 1:
                    case 2:
                    case 3:
                        $arrBanners[] = array
                        (
                                'banner_key'     => 'bid=',
                                'banner_wrap_id'    => $banner_cssID,
                                'banner_wrap_class' => $banner_class,
                                'banner_id'      => $objBanners->id,
                                'banner_name'    => specialchars(ampersand($objBanners->banner_name)),
                                'banner_url'     => $objBanners->banner_url,
                                'banner_target'  => $banner_target,
                                'banner_comment' => specialchars(ampersand($objBanners->banner_comment)),
                                'src'            => specialchars(ampersand($FileSrc)),//specialchars(ampersand($this->urlEncode($FileSrc))),
                                'alt'            => specialchars(ampersand($objBanners->banner_name)),
                                'size'           => $arrImageSize[3],
                                'banner_pic'     => true,
                                'banner_flash'   => false,
                                'banner_text'    => false,
                                'banner_empty'   => false,
                                'picture'        => $picture
                        );
                        break;
                    case 4:  // Flash swf
                    case 13: // Flash swc
                        list($usec, ) = explode(" ", microtime());
                        
                        //Check for Fallback Image, only for local flash files (Path,Breite,Höhe)
                        $src_fallback = $this->BannerImage->getCheckBannerImageFallback($FileSrc,$arrImageSize[0],$arrImageSize[1]);
                        if ($src_fallback !== false)
                        {
                            //Fallback gefunden
                            if ($this->strFormat == 'xhtml') 
                            {
                                $fallback_content = '<img src="' . $src_fallback . '" alt="'.specialchars(ampersand($objBanners->banner_comment)).'" height="'.$arrImageSize[1].'" width="'.$arrImageSize[0].'" />';
                            } 
                            else 
                            {
                                $fallback_content = '<img src="' . $src_fallback . '" alt="'.specialchars(ampersand($objBanners->banner_comment)).'" height="'.$arrImageSize[1].'" width="'.$arrImageSize[0].'">';
                            }
                        }
                        else
                        {
                            //kein Fallback
                            if ($this->strFormat == 'xhtml')
                            {
                                $fallback_content = $FileSrc ."<br />". specialchars(ampersand($objBanners->banner_comment)) ."<br />". specialchars(ampersand($objBanners->banner_name));
                            } 
                            else 
                            {
                                $fallback_content = $FileSrc ."<br>". specialchars(ampersand($objBanners->banner_comment)) ."<br>". specialchars(ampersand($objBanners->banner_name));
                            }
                        }
                        $arrBanners[] = array
                        (
                            'banner_key'     => 'bid=',
                            'banner_wrap_id'    => $banner_cssID,
                            'banner_wrap_class' => $banner_class,
                            'banner_id'      => $objBanners->id,
                            'banner_name'    => specialchars(ampersand($objBanners->banner_name)),
                            'banner_url'     => $objBanners->banner_url,
                            'banner_target'  => $banner_target,
                            'banner_comment' => specialchars(ampersand($objBanners->banner_comment)),
                            'swf_src'        => specialchars(ampersand($FileSrc)),
                            'swf_width'      => $arrImageSize[0],
                            'swf_height'     => $arrImageSize[1],
                            'swf_id'         => round((float)$usec*100000,0).'_'.$objBanners->id,
                            'alt'            => specialchars(ampersand($objBanners->banner_name)),
                            'fallback_content'=> $fallback_content,
                            'banner_pic'     => false,
                            'banner_flash'   => true,
                            'banner_text'    => false,
                            'banner_empty'   => false
                        );
                        break;
                    default:
                        $arrBanners[] = array
                        (
                            'banner_key'     => 'bid=',
                            'banner_wrap_id'    => $banner_cssID,
                            'banner_wrap_class' => $banner_class,
                            'banner_id'      => 0,
                            'banner_name'    => '',
                            'banner_url'     => '',
                            'banner_target'  => '',
                            'banner_comment' => '',
                            'src'            => '',
                            'alt'            => '',
                            'size'           => '',
                            'banner_pic'     => true,
                        );
                        break;
                }//switch
                
                //anderes Template?
                if (($this->banner_template != $this->strTemplate) 
                 && ($this->banner_template != ''))
                {
                    $this->strTemplate = $this->banner_template;
                    $this->Template = new \FrontendTemplate($this->strTemplate);
                }
                $this->arrBannerData = $arrBanners; //wird von BannerStatViewUpdate genutzt
                $this->setStatViewUpdate();
                $this->Template->banners = $arrBanners;
                return true;
                
            }//$arrImageSize !== false
            
            // Text Banner
            if ($objBanners->banner_type == 'banner_text') 
            {
                if ($this->strFormat == 'xhtml')
                {
                    $banner_target = ($objBanners->banner_target == '1') ? LINK_BLUR : LINK_NEW_WINDOW;
                } 
                else 
                {
                    $banner_target = ($objBanners->banner_target == '1') ? '' : ' target="_blank"';
                }

                // Banner Seite als Ziel?
                if ($objBanners->banner_jumpTo > 0) 
                {
                    $domain = \Environment::get('base');
                    $objParent = \PageModel::findWithDetails($objBanners->banner_jumpTo);
                    if ($objParent !== null) // is null when page not exist anymore
                    {
                        if ($objParent->domain != '')
                        {
                            $domain = (\Environment::get('ssl') ? 'https://' : 'http://') . $objParent->domain . TL_PATH . '/';
                        }
                        $objBanners->banner_url = $domain . $this->generateFrontendUrl($objParent->row(), '', $objParent->language);
                    }
                }
                
                // Kurz URL (nur Domain)
                $treffer = parse_url(\Idna::decode($objBanners->banner_url)); // #79
                $banner_url_kurz = $treffer['host'];
                if (isset($treffer['port'])) 
                {
                    $banner_url_kurz .= ':'.$treffer['port'];
                }
                
                $arrBanners[] = array
                (
                        'banner_key'     => 'bid=',
                        'banner_wrap_id'    => $banner_cssID,
                        'banner_wrap_class' => $banner_class,
                        'banner_id'      => $objBanners->id,
                        'banner_name'    => specialchars(ampersand($objBanners->banner_name)),
                        'banner_url'     => $objBanners->banner_url,
                        'banner_url_kurz'=> $banner_url_kurz,
                        'banner_target'  => $banner_target,
                        'banner_comment' => ampersand(nl2br($objBanners->banner_comment)),
                        'banner_pic'     => false,
                        'banner_flash'   => false,
                        'banner_text'    => true,
                        'banner_empty'   => false	// issues 733
                );
                if (($this->banner_template != $this->strTemplate) 
                 && ($this->banner_template != '')) 
                {
                    $this->strTemplate = $this->banner_template;
                    $this->Template = new \FrontendTemplate($this->strTemplate);
                }
                $arrResults[] = $arrBanners[0];
                $this->Template->banners = $arrResults;
                 
                $this->arrBannerData = $arrResults;
                $this->setStatViewUpdate();
                return true;
            }
        }//Banner vorhanden
        //falls $arrImageSize = false  und kein Text Banner
        $this->Template->banners = $arrBanners; // leeres array
	}
932027
public function showVersionStatus()
        {
                $update_needed = false;

        $output = "<table class='tableBorder'>";
                $output .= "<tr><td class='tableHead' colspan='2'>IDS Version</td></tr>";

                $output .= "<tr><td class='tableCell' valign='top'>Filter:</td>\n<td class='tableCell'>";
                if ($this->isRulesUpdated()) {
                        $output .=  "<span style='color: green;'>aktuell.</span>";
                } else {
                        $output .=  "<span style='color: red;'>nicht aktuell.</span>";
                        $update_needed = true;
                }
                $output .= "<br />Letzte lokale &Auml;nderung: <strong>".$this->getLastRulesUpdate()."</strong><br />";
                $output .= "Letzte &Auml;nderung auf php-ids.org: <strong>".$this->getLastFileUpdate(self::FILENAME_RULES)."</strong><br />";
                $output .= "SHA-1 Hash: <br /> <code>".$this->getLocalFileHash(self::FILENAME_RULES)."</code>";
                if (!$this->isRulesUpdated()) {
                        $output .= "(local)<br /> <code>".$this->getCurrentFileHash(self::FILENAME_RULES)."</code>(remote)";
                }
                $output .= "</td></tr>";

                $output .= "<tr><td class='tableCell' valign='top'>Converter:</td>\n<td class='tableCell'>";
                if ($this->isConverterUpdated()) {
                        $output .=  "<span style='color: green;'>aktuell.</span>";
                } else {
                        $output .=  "<span style='color: red;'>nicht aktuell.</span>";
                        $update_needed = true;
                }
                $output .= "<br />Letzte lokale &Auml;nderung: <strong>".$this->getLastConverterUpdate()."</strong><br />";
                $output .= "Letzte &Auml;nderung auf php-ids.org: <strong>".$this->getLastFileUpdate(self::FILENAME_CONVERTER)."</strong><br />";
                $output .= "SHA-1 Hash: <br /> <code>".$this->getLocalFileHash(self::FILENAME_CONVERTER)."</code>";
                if (!$this->isConverterUpdated()) {
                        $output .= "(local)<br /> <code>".$this->getCurrentFileHash(self::FILENAME_CONVERTER)."</code>(remote)";
                }
                $output .= "</td></tr>";

                // is update possible?
                if (!$this->isRulesUpdated() || !$this->isConverterUpdated()) {
                        $output .= "<tr><td class='tableCell'> </td>\n<td class='tableCell'>";
                        if ($this->isWritable() && function_exists("curl_init")) {
                                $output .= "<form method='POST'>";
                                $output .= "<input type='submit' name='update_phpids' value='Automatisch Aktualisieren' />";
                                $output .= "</form>";
                        } else {
                                $output .= "Kein automatisches Update verf&uuml;gbar. (Dateien beschreibbar/ Curl-Extension verf&uuml;gbar?)";
                        }
                        $output .= "</td></tr>";
                }

                $output .= "</table>";

                return $output;
        }
488375
def exif_name(self):
        '''
        
        '''
        mapillary_description = json.loads(self.extract_image_description())

        lat = None
        lon = None
        ca = None
        date_time = None

        if "MAPLatitude" in mapillary_description:
            lat = mapillary_description["MAPLatitude"]
        if "MAPLongitude" in mapillary_description:
            lon = mapillary_description["MAPLongitude"]
        if "MAPCompassHeading" in mapillary_description:
            if 'TrueHeading' in mapillary_description["MAPCompassHeading"]:
                ca = mapillary_description["MAPCompassHeading"]['TrueHeading']
        if "MAPCaptureTime" in mapillary_description:
            date_time = datetime.datetime.strptime(
                mapillary_description["MAPCaptureTime"], "%Y_%m_%d_%H_%M_%S_%f").strftime("%Y-%m-%d-%H-%M-%S-%f")[:-3]

        filename = '{}_{}_{}_{}_{}'.format(
            lat, lon, ca, date_time, uuid.uuid4())
        return filename