Output XML for Image Gallery
rlm@3: Create the xml for the image inside which folder? Set the folder to look at to create the XML automagically. rlm@3:rlm@3:
rlm@3: Default file paths are:
rlm@3: $fold){ rlm@3: if ($fold=='' || $fold=='.') continue; rlm@3: if ($fold=='..' && $i>0 && end($out)!='..') array_pop($out); rlm@3: else $out[]= $fold; rlm@3: } return ($path{0}=='/'?'/':'').join('/', $out); rlm@3: } rlm@3: ?> rlm@3: Gallery Path: Galleries/gallery1/ rlm@3:
rlm@3: Large Path: Galleries/gallery1/large/ rlm@3:
rlm@3: Thumbnail Path: Galleries/gallery1/thumbs/ rlm@3:
rlm@3: 1024) $files[$fkey]['sizetext'] = (ceil($a['size']/1024*100)/100) . " K"; rlm@3: else if ($a['size'] > 1024*1024) $files[$fkey]['sizetext'] = (ceil($a['size']/(1024*1024)*100)/100) . " Mb"; rlm@3: else $files[$fkey]['sizetext'] = $a['size'] . " bytes"; rlm@3: $files[$fkey]['name'] = $file; rlm@3: $files[$fkey]['type'] = filetype($fullpath); rlm@3: $fileNames[$i++] = $fkey; rlm@3: } rlm@3: closedir($dh); rlm@3: } else {$errorMessage= true; echo "Cannot open directory: $path | Fill out a valid Gallery Path";} rlm@3: } else {$errorMessage= true; echo "Path is not a directory: $path | Fill out a valid Gallery Path";} rlm@3: sort($fileNames,SORT_STRING); rlm@3: $sortedFiles = array(); rlm@3: $i = 0; rlm@3: $photos = array(); rlm@3: $relativePath = rp( dirname($_SERVER['PHP_SELF']) ); rlm@3: if($errorMessage != true){ rlm@3: foreach($fileNames as $f) $sortedFiles[$i++] = $files[$f]; rlm@3: rlm@3: rlm@3: echo'Copy the below XML and create your XML file and upload it via the Upload XML button above:'; rlm@3: echo'Reset Output'; rlm@3: echo '
';
rlm@3: echo'<gallery>
'; rlm@3: echo' <title>'.$_GET['gallerytitle'].'</title>
'; rlm@3: echo' <description>'.$_GET['galleryDescription'].'</description>
'; rlm@3: echo' <gallerypath>'.$relativePath.'/'.$_GET['gallerypath'].'</gallerypath>
'; rlm@3: echo' <largeimgpath>'.$relativePath.'/'.$_GET['largepath'].'</largeimgpath>
'; rlm@3: echo' <thumbpath>'.$relativePath.'/'.$_GET['thumbpath'].'</thumbpath>
'; rlm@3: echo' <mainthumb>'.$relativePath.'/'.$_GET['gallerypath'].'</mainthumb>
'; rlm@3: echo' <mainthumbsrc>mainthumb.jpg</mainthumbsrc>
'; rlm@3: $j = 0; rlm@3: rlm@3: foreach ($sortedFiles as $file) { rlm@3: rlm@3: if($file['type']!='dir'&& $file['name']!='mainthumb.jpg'){ rlm@3: // get image sizes rlm@3: list($width, $height, $type, $attr) = getimagesize($path."/".$file['name'], $info); rlm@3: $size = $file['sizetext']; rlm@3: if(isset($info['APP13'])){ rlm@3: $iptc = iptcparse($info['APP13']); rlm@3: $title = $iptc['2#005'][0]; rlm@3: if(isset($iptc['2#120'][0])){ rlm@3: $description = $iptc['2#120'][0]; rlm@3: $description = str_replace("\r", "
", $description); rlm@3: $description = addslashes($description); rlm@3: } rlm@3: if(isset($iptc['2#025'][0])){ rlm@3: $keywords = $iptc['2#025'][0]; rlm@3: } rlm@3: $author = $iptc['2#080'][0]; rlm@3: $copyright = $iptc['2#116'][0]; rlm@3: rlm@3: }else if(isset($info['APP0']) && !isset($info['APP13'])){ rlm@3: $iptc = iptcparse($info['APP0']); rlm@3: $title = $iptc['2#005'][0]; rlm@3: $description = $iptc['2#120'][0]; rlm@3: $description = str_replace("\r", "
", $description); rlm@3: $description = addslashes($description); rlm@3: $keywords = $iptc['2#025'][0]; rlm@3: $author = $iptc['2#080'][0]; rlm@3: $copyright = $iptc['2#116'][0]; rlm@3: }else{ rlm@3: $title = ''; rlm@3: $description = ''; rlm@3: $description = ''; rlm@3: $keywords = ''; rlm@3: $author = ''; rlm@3: $copyright = ''; rlm@3: } rlm@3: rlm@3: rlm@3: array_push($photos, $width); rlm@3: array_push($photos, $height); rlm@3: rlm@3: //echo'';
rlm@3: //' ';
rlm@3: //echo' ';
rlm@3:
rlm@3: echo' <item type="image">
'; rlm@3: echo' <title>'.$title.'</title>
'; rlm@3: echo' <author>'.$author.'</author>
'; rlm@3: echo' <copyright>'.$copyright.'</copyright>
'; rlm@3: echo' <description>'.$description.'</description>
'; rlm@3: echo' <src>'.$file['name'].'</src>
'; rlm@3: echo' <demensions width="'.$width.'" height="'.$height.'" />
'; rlm@3: if(isset($_GET['largepath'])){ rlm@3: $largePath = $_GET['largepath']; rlm@3: if(is_file($largePath."/".$file['name'])){ rlm@3: list($largeWidth, $largeHeight, $largeType, $largeAttr) = getimagesize($largePath."/".$file['name'], $info); rlm@3: echo' <large width="'.$largeWidth.'" height="'.$largeHeight.'" />
'; rlm@3: } rlm@3: } rlm@3: if(isset($_GET['showforsale'])){ rlm@3: $showforsale = $_GET['showforsale']; rlm@3: if($showforsale=='true'){ rlm@3: if($_GET['currency']=="USD"){$currencySymbol='$';}else if($_GET['currency']=="EURO"){$currencySymbol='€';} rlm@3: echo' <sellprint type="'.$_GET['checkouttype'].'" currency="'.$_GET['currency'].'" currencysymbol="'.$currencySymbol.'">
'; rlm@3: echo' <price size="8x10">15</price>
'; rlm@3: echo' <price size="11x14">25</price>
'; rlm@3: echo' <price size="16x20">55</price>
'; rlm@3: echo' <price size="20x24">65</price>
'; rlm@3: echo' </sellprint>
'; rlm@3: } rlm@3: echo' </item>
'; rlm@3: rlm@3: $j++; rlm@3: } rlm@3: } rlm@3: rlm@3: } rlm@3: echo' <totalitems>'.$j.'</totalitems>
'; rlm@3: echo'</gallery>
'; rlm@3: echo'
';
rlm@3: }
rlm@3: }
rlm@3: if(isset($_GET['gallerypath'])&&isset($_GET['thumbpath'])){
rlm@3: getImages($_GET['gallerypath'], $_GET['thumbpath'] );
rlm@3: ?>
rlm@3: Reset Output
rlm@3: '; rlm@3: echo' <title>'.$_GET['gallerytitle'].'</title>
'; rlm@3: echo' <description>'.$_GET['galleryDescription'].'</description>
'; rlm@3: echo' <gallerypath>'.$relativePath.'/'.$_GET['gallerypath'].'</gallerypath>
'; rlm@3: echo' <largeimgpath>'.$relativePath.'/'.$_GET['largepath'].'</largeimgpath>
'; rlm@3: echo' <thumbpath>'.$relativePath.'/'.$_GET['thumbpath'].'</thumbpath>
'; rlm@3: echo' <mainthumb>'.$relativePath.'/'.$_GET['gallerypath'].'</mainthumb>
'; rlm@3: echo' <mainthumbsrc>mainthumb.jpg</mainthumbsrc>
'; rlm@3: $j = 0; rlm@3: rlm@3: foreach ($sortedFiles as $file) { rlm@3: rlm@3: if($file['type']!='dir'&& $file['name']!='mainthumb.jpg'){ rlm@3: // get image sizes rlm@3: list($width, $height, $type, $attr) = getimagesize($path."/".$file['name'], $info); rlm@3: $size = $file['sizetext']; rlm@3: if(isset($info['APP13'])){ rlm@3: $iptc = iptcparse($info['APP13']); rlm@3: $title = $iptc['2#005'][0]; rlm@3: if(isset($iptc['2#120'][0])){ rlm@3: $description = $iptc['2#120'][0]; rlm@3: $description = str_replace("\r", "
", $description); rlm@3: $description = addslashes($description); rlm@3: } rlm@3: if(isset($iptc['2#025'][0])){ rlm@3: $keywords = $iptc['2#025'][0]; rlm@3: } rlm@3: $author = $iptc['2#080'][0]; rlm@3: $copyright = $iptc['2#116'][0]; rlm@3: rlm@3: }else if(isset($info['APP0']) && !isset($info['APP13'])){ rlm@3: $iptc = iptcparse($info['APP0']); rlm@3: $title = $iptc['2#005'][0]; rlm@3: $description = $iptc['2#120'][0]; rlm@3: $description = str_replace("\r", "
", $description); rlm@3: $description = addslashes($description); rlm@3: $keywords = $iptc['2#025'][0]; rlm@3: $author = $iptc['2#080'][0]; rlm@3: $copyright = $iptc['2#116'][0]; rlm@3: }else{ rlm@3: $title = ''; rlm@3: $description = ''; rlm@3: $description = ''; rlm@3: $keywords = ''; rlm@3: $author = ''; rlm@3: $copyright = ''; rlm@3: } rlm@3: rlm@3: rlm@3: array_push($photos, $width); rlm@3: array_push($photos, $height); rlm@3: rlm@3: //echo'
'; rlm@3: echo' <title>'.$title.'</title>
'; rlm@3: echo' <author>'.$author.'</author>
'; rlm@3: echo' <copyright>'.$copyright.'</copyright>
'; rlm@3: echo' <description>'.$description.'</description>
'; rlm@3: echo' <src>'.$file['name'].'</src>
'; rlm@3: echo' <demensions width="'.$width.'" height="'.$height.'" />
'; rlm@3: if(isset($_GET['largepath'])){ rlm@3: $largePath = $_GET['largepath']; rlm@3: if(is_file($largePath."/".$file['name'])){ rlm@3: list($largeWidth, $largeHeight, $largeType, $largeAttr) = getimagesize($largePath."/".$file['name'], $info); rlm@3: echo' <large width="'.$largeWidth.'" height="'.$largeHeight.'" />
'; rlm@3: } rlm@3: } rlm@3: if(isset($_GET['showforsale'])){ rlm@3: $showforsale = $_GET['showforsale']; rlm@3: if($showforsale=='true'){ rlm@3: if($_GET['currency']=="USD"){$currencySymbol='$';}else if($_GET['currency']=="EURO"){$currencySymbol='€';} rlm@3: echo' <sellprint type="'.$_GET['checkouttype'].'" currency="'.$_GET['currency'].'" currencysymbol="'.$currencySymbol.'">
'; rlm@3: echo' <price size="8x10">15</price>
'; rlm@3: echo' <price size="11x14">25</price>
'; rlm@3: echo' <price size="16x20">55</price>
'; rlm@3: echo' <price size="20x24">65</price>
'; rlm@3: echo' </sellprint>
'; rlm@3: } rlm@3: echo' </item>
'; rlm@3: rlm@3: $j++; rlm@3: } rlm@3: } rlm@3: rlm@3: } rlm@3: echo' <totalitems>'.$j.'</totalitems>
'; rlm@3: echo'</gallery>
'; rlm@3: echo'
Create New Gallery XML:
rlm@3:
rlm@3: rlm@3:
rlm@3: rlm@3: rlm@3: rlm@3: rlm@3: rlm@3: rlm@3: rlm@3: rlm@3: