Inventur der Shopware-Grafiken

Um einen Überblick über die in Shopware verwendeten Grafiken zu erhalten, habe ich ein kleines Programm entwickelt, das diese Grafiken auflistet. Ist sicher allgemein ganz hilfreich um zu sehen, was man wo für eigene Designs ändern muss. Den folgenden Code als „graphics_list.php“ in der Shop-Root speichern, und dann mit „http://www.mein_shop.de/graphics_list.php“ starten. Das Programm prüft zunächst, ob im Verzeichnis „templates/_local/frontend/_resources/images/“ Grafiken enthalten sind. Wenn ja, wird dieses Verzeichnis analysiert, sonst „templates/_default/frontend/_resources/images/“. HTH [code]<?php /*
Copyright 2011: Avenger, entwicklung@powertemplate.de
*/
$graphics_dir0 = „templates/#/frontend/_resources/images/“;
$graphics_dir = str_replace(’#’,’_local’,$graphics_dir0);
if (!is_file($graphics_dir.‚sprite_blog.gif‘))
{
$graphics_dir = str_replace(’#’,’_default’,$graphics_dir0);
}
$graphics_dir_1=$graphics_dir.’/’;
$html_header=’

Unterverzeichnis „%s“ | ‚; $html_entry=‘ | %s | %s | %s |
‚; $html=$last_dir=‘’; $files=my_glob($graphics_dir,’{*.gif,*.jpg,*.png}’,-1,GLOB_BRACE); foreach ($files as $file) { $file_short=str_replace($graphics_dir_1,’’,str_replace(’\’,’/’,$file)); if (strpos($file_short,’/’)!==false) { $this_dir=dirname($file_short); if ($last_dir<>$this_dir) { $last_dir=$this_dir; $html.=sprintf($html_header,$this_dir); } } $file_info=getimagesize($file); $width=$file_info[‚0‘]; $height=$file_info[‚1‘]; $size=$width.’ x '.$height; $html.=sprintf($html_entry, basename($file_short), ’ ‚, $size); } $html=‘
.image img {
max-width:400px;
}

.header {
background-color:red;
color:white;
font-weight:bold;
}

| Vorhandene Grafiken im Verzeichnis „’.$graphics_dir.’“ (’.sizeof($files).’ Stück) |
| Grafik-Name | Grafik-Bild | Grafik-Maße
B x H (Pixel)
|
‚.$html.‘

‚; echo $html; function my_glob($path, $pattern = ‚*‘, $depth = 0, $flags = 0) { $matches = array(); $folders = array(rtrim($path, DIRECTORY_SEPARATOR)); while ($folder = array_shift($folders)) { $matches = array_merge($matches, glob($folder.DIRECTORY_SEPARATOR.$pattern, $flags)); if($depth != 0) { $moreFolders = glob($folder.DIRECTORY_SEPARATOR.‘*’, GLOB_ONLYDIR); $depth = ($depth < -1) ? -1: $depth + count($moreFolders) - 2; $folders = array_merge($folders, $moreFolders); } } return $matches; } ?>[/code]

Moin, schönes Sache :wink: Beim Bild-Pfad ist noch ein Fehler: [code]

|[/code]

[quote=„ottscho“]Moin, schönes Sache :wink: Beim Bild-Pfad ist noch ein Fehler: [code]

|[/code][/quote] Komisch, ist bei mir OK…

Nettes Tool, Danke. :thumbup:

Passend zum Thema: http://www.shopware.de/wiki/_detail_664.html