Login   Register  
PHP Classes
elePHPant
Icontem

File: site_scanner.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Karl Holz  >  Image Embedder  >  site_scanner.php  >  Download  
File: site_scanner.php
Role: Application script
Content type: text/plain
Description: php cli utility to scan all xhtml/well formed html files in current directory and encode the images under 50k
Class: Image Embedder
Replace images with embedded data in HTML pages
Author: By
Last change:
Date: 2 years ago
Size: 724 bytes
 

Contents

Class file image Download
<?
require_once('img_fixer.php');

if (
PHP_SAPI === 'cli') {
 
$home=getcwd();

 if (
is_file($argv[1])) {  
  if (
is_numeric($argv[2])) { new img_embedder($argv[1], $argv[2]); } 
  else { new 
img_embedder($argv[1]); }
 } elseif(
$argv[1] == '--help' || $argv[1] == '-h' || $argv[1] == '/?') {
    echo 
img_embedder::help(); exit();
 } elseif(
$argv[1] == '--scan' || $argv[1] == '-s') {
  foreach (
glob('{*.html,*/*.html,*/*/*.html}'GLOB_BRACE) as $f) {
   
chdir(dirname($f));
//    echo basename($f)." is in home: ".  getcwd()." \n";
   
new img_embedder(basename($f));
   
chdir($home);
  }
 } else{
    echo 
img_embedder::help(); exit();
 }    
} else { die(
"This tool is not designed for web use\n"); }