Subversion Repositories eFlore/Projets.eflore-projets

Rev

Rev 270 | Rev 355 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 270 Rev 273
Line 315... Line 315...
315
		$fichierCarteSvg = $this->cheminCartesBase.self::CARTE_DEFAUT.'.svg';
315
		$fichierCarteSvg = $this->cheminCartesBase.self::CARTE_DEFAUT.'.svg';
316
		$dom->load($fichierCarteSvg);
316
		$dom->load($fichierCarteSvg);
Line 317... Line 317...
317
 
317
 
318
		$racineElement = $dom->documentElement;
318
		$racineElement = $dom->documentElement;
-
 
319
		$racineElement->setAttribute('width', $this->imgLargeur);
-
 
320
		if ($this->imgHauteur != 0) {
-
 
321
			$racineElement->setAttribute('height', $this->imgHauteur);
Line 319... Line 322...
319
		$racineElement->setAttribute('width', $this->imgLargeur);
322
		}
320
 
323
 
321
		$css = $this->creerCssCarte();
324
		$css = $this->creerCssCarte();
322
		$styleElement = $dom->getElementsByTagName('style')->item(0);
325
		$styleElement = $dom->getElementsByTagName('style')->item(0);
Line 439... Line 442...
439
		$convertisseur->destroy();
442
		$convertisseur->destroy();
440
		return $png;
443
		return $png;
441
	}
444
	}
Line 442... Line 445...
442
 
445
 
443
	private function convertirEnPNGAvecRsvg($svg) {
446
	private function convertirEnPNGAvecRsvg($svg) {
444
		$idFichier = md5($svg);
447
		$idFichier = $this->getIdFichier();
445
		$fichierPng = $this->config['cache']['stockageChemin'].$idFichier.'.png';
448
		$fichierPng = $this->config['cache']['stockageChemin'].$idFichier.'.png';
446
		$fichierSvg = $this->config['cache']['stockageChemin'].$idFichier.'.svg';
449
		$fichierSvg = $this->config['cache']['stockageChemin'].$idFichier.'.svg';
447
		file_put_contents($fichierSvg, $svg);
450
		file_put_contents($fichierSvg, $svg);
-
 
451
		$commande = "rsvg-convert $fichierSvg -d 75 -p 75 -o $fichierPng";
-
 
452
		$rsvg = exec($commande);
448
		$rsvg = exec("rsvg-convert $fichierSvg -d 75 -p 75 -o $fichierPng");
453
 
449
		$this->indexerFichierPng($fichierPng);
454
		$this->indexerFichierPng($fichierPng);
450
		$png = file_get_contents($fichierPng);
455
		$png = file_get_contents($fichierPng);
451
		return $png;
456
		return $png;
Line 455... Line 460...
455
		$img = imagecreatefrompng($fichierPng);
460
		$img = imagecreatefrompng($fichierPng);
456
		imagetruecolortopalette($img, false, 32);
461
		imagetruecolortopalette($img, false, 32);
457
		imagepng($img, $fichierPng, 9, PNG_ALL_FILTERS);
462
		imagepng($img, $fichierPng, 9, PNG_ALL_FILTERS);
458
	}
463
	}
Line -... Line 464...
-
 
464
 
-
 
465
	private function getIdFichier() {
-
 
466
		$id = '';
-
 
467
		foreach ($this->taxonsDemandes as $reftax => $ids) {
-
 
468
			$id[] = $reftax;
-
 
469
			foreach ($ids as $type => $vals) {
-
 
470
				$id[] = $type;
-
 
471
				$id[] = implode('-', $vals);
-
 
472
			}
-
 
473
		}
-
 
474
		$id = implode('-', $id);
-
 
475
		return $id;
-
 
476
	}
459
 
477
 
460
	public function getParametreTableau($cle) {
478
	public function getParametreTableau($cle) {
461
		$tableau = array();
479
		$tableau = array();
462
		$parametre = $this->config[$cle];
480
		$parametre = $this->config[$cle];
463
		if (empty($parametre) === false) {
481
		if (empty($parametre) === false) {