Example #1
0
function main()
{
    if (!isset($_GET['url']) || !preg_match('#^http.?://.+\\.tumblr\\.com.*#i', $_GET['url'])) {
        echo $_GET['url'];
        exit('Hello Visitor!');
    }
    $strPageSource = getPageSource(encode_cjk_url($_GET['url']));
    #get HTML page source code
    !$strPageSource && echoImageNotFoundTextFileAndExit($_GET['url']);
    $arrImagesUrls = parseImagesUrls($strPageSource);
    #parse urls of images
    $intCountOfImagesUrls = count($arrImagesUrls);
    $intCountOfImagesUrls === 0 && echoImageNotFoundTextFileAndExit($_GET['url']);
    #no image url found, echo error message as txt file.
    $intCountOfImagesUrls === 1 && redirectAndExit(array_pop($arrImagesUrls));
    #we got just one image url to be fetch, so no need for fetching, just redirect the browser to it.
    $arrContentAndUrlOfValidImages = fetchImages($arrImagesUrls);
    #not every url is available, so try every one.
    $intCountOfValidImagesUrls = count($arrContentAndUrlOfValidImages['validImagesUrls']);
    #check out the number of available urls
    $intCountOfValidImagesUrls === 0 && echoImageNotFoundTextFileAndExit($_GET['url']);
    $intCountOfValidImagesUrls === 1 && redirectAndExit(array_pop($arrContentAndUrlOfValidImages['validImagesUrls']));
    #if we got just one available url, no need to pack the image cause we could just redirect the browser.
    //when we got multiple images to deal with
    $strZipString = makeZipPack($arrContentAndUrlOfValidImages['imageStrings'], $arrContentAndUrlOfValidImages['validImagesUrls']);
    outputZipPackAsFileDownload($strZipString);
}
Example #2
0
function fetchImages($files, &$images, $name = 'file')
{
    if (isset($files['tmp_name'])) {
        $filename = $files['tmp_name'];
        list($mime) = explode(';', @mime_content_type($filename));
        if (strpos($mime, 'image') !== false) {
            $content = file_get_contents($filename);
            $images[$name] = 'data:' . $mime . ';base64,' . base64_encode($content);
        }
    } else {
        foreach ($files as $name => $file) {
            fetchImages($file, $images, $name);
        }
    }
}
Example #3
0
function fetchImages($files, &$images, $name = 'file')
{
    if (isset($files['tmp_name'])) {
        $filename = $files['tmp_name'];
        list($mime) = explode(';', @mime_content_type($filename));
        if (strpos($mime, 'image') !== false) {
            $size = getimagesize($filename);
            $base64 = base64_encode(file_get_contents($filename));
            $images[$name] = array('width' => $size[0], 'height' => $size[1], 'mime' => $mime, 'size' => filesize($filename), 'dataURL' => 'data:' . $mime . ';base64,' . $base64);
        }
    } else {
        foreach ($files as $name => $file) {
            fetchImages($file, $images, $name);
        }
    }
}
Example #4
0
function main()
{
    (!isset($_GET['url']) || !filter_var($_GET['url'], FILTER_VALIDATE_URL)) && exit('Hello World!');
    $strPageSource = getPageSource($_GET['url']);
    #get HTML page source code
    !$strPageSource && echoImageNotFoundTextFileAndExit($_GET['url']);
    $arrImagesUrls = parseImagesUrls($strPageSource);
    #parse urls of images
    $intCountOfImagesUrls = count($arrImagesUrls);
    $intCountOfImagesUrls === 0 && echoImageNotFoundTextFileAndExit($_GET['url']);
    #no image url found, echo error message as txt file.
    $intCountOfImagesUrls === 1 && redirectAndExit(array_pop($arrImagesUrls));
    #we got just one image url to be fetch, so no need for fetching, just redirect the browser to it.
    $arrContentAndUrlOfValidImages = fetchImages($arrImagesUrls);
    #not every url is available, so try every one.
    $intCountOfValidImagesUrls = count($arrContentAndUrlOfValidImages['validImagesUrls']);
    #check out the number of available urls
    $intCountOfValidImagesUrls === 0 && echoImageNotFoundTextFileAndExit($_GET['url']);
    $intCountOfValidImagesUrls === 1 && redirectAndExit(array_pop($arrContentAndUrlOfValidImages['validImagesUrls']));
    #if we got just one available url, no need to pack the image cause we could just redirect the browser.
    //when we got multiple images to deal with
    $strZipString = makeZipPack($arrContentAndUrlOfValidImages['imageStrings'], $arrContentAndUrlOfValidImages['validImagesUrls']);
    outputZipPackAsFileDownload($strZipString);
}
Example #5
0
    $cartesianArr = fetchImages($pieceid, $dbcon);
    $availability = $parr['availability'];
    $complist = $parr['complist'];
    $compquantity = $parr['compquantity'];
}
if (!empty($_POST)) {
    // echo "<pre>";
    // var_dump($_POST);
    // echo "</pre>";
    $error = "";
    $pcmode = prepare_input($_POST['pcmode']);
    $pieceid = prepare_input($_POST['pieceid']);
    if (!empty($pieceid)) {
        $carouselImg = prepare_input($_POST['carouselImgname']);
        $hookImg = prepare_input($_POST['hookImgName']);
        $cartesianArr = fetchImages($pieceid, $dbcon);
        // 		echo "<pre>";
        // var_dump($cartesianArr);
        // echo "</pre>";
    }
    $pcenterx = prepare_input($_POST['pcenterx']);
    $pcentery = prepare_input($_POST['pcentery']);
    $pctop = prepare_input($_POST['pctop']);
    $pcbody = prepare_input($_POST['pcbody']);
    $pcbot = prepare_input($_POST['pcbot']);
    $pprice = prepare_input($_POST['pprice']);
    $pname = prepare_input($_POST['pname']);
    $pquantity = prepare_input($_POST['pquantity']);
    $priority = prepare_input($_POST['priority']);
    $pimgheight = prepare_input($_POST['pimgheight']);
    $pimgwidth = prepare_input($_POST['pimgwidth']);
Example #6
0
        ?>
				<p><?php 
        echo $descr;
        ?>
</p>
				</td>
			</tr>
		</table>
	<?php 
    }
} else {
    echo '<h2>There are currently no public images.</h2>';
}
?>
<h1>Deleted Images:</h1><?php 
$images = fetchImages(3);
if ($images != false) {
    foreach ($images as $image) {
        $pw = explode("!", $image['image']);
        ?>
		<table>
			<tr class="yellow">
				<td><h2><?php 
        echo $image['title'];
        ?>
<form action="" method="post"><input type="submit" name="accept" value="<?php 
        echo $image['id'];
        ?>
:Recover Image"/></form></h2></td>
			</tr>
			<tr>