PHP Classes

File: get_thumbs.php

Recommend this page to a friend!
  Classes of Olaf Lederer   Import templates   get_thumbs.php   Download  
File: get_thumbs.php
Role: Application script
Content type: text/plain
Description: A tool to copy (batch) thumbnails from TM
Class: Import templates
Import data about TemplateMonster.com templates
Author: By
Last change:
Date: 18 years ago
Size: 1,762 bytes
 

Contents

Class file image Download
<?php
set_time_limit
(1200); // you need to change this if this value (seconds) is to low/high
require($_SERVER['DOCUMENT_ROOT']."/classes/import_templates/import_templates.php");

function
microtime_float() {
   list(
$usec, $sec) = explode(" ", microtime());
   return ((float)
$usec + (float)$sec);
}
if (isset(
$_POST['Submit'])) {
   
$time_start = microtime_float();
   
$test_import = new Import_templates;
   
$counter = 0;
   
$total = $_POST['end'] - $_POST['start'];
    for (
$i = $_POST['start']; $i < $_POST['end']; $i++) {
        if (
$test_import->copy_thumbs($i)) $counter++;
    }
   
$time_end = microtime_float();
   
$msg = "... executed in ".$time = $time_end - $time_start." seconds<br>";
   
$msg .= "Copied ".$counter." of ".$total." thumbnails!";
} else {
   
$msg = "&nbsp;";
}
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>TM thumbnail copy tool</title>
</head>

<body>
<h2>TM thumbnail copy tool</h2>
<p>Use this file to copy thumbnails (files like 8938-m.jpg) on you own server with the same directory structure like on templatemonster.
With the current time limit its possible to copy ca. 700 thumbnails a time. </p>
<form method="post">
  <label for="start">Start number</label>
(incl.)
<input name="start" type="text" value="<?php echo (isset($_POST['start'])) ? $_POST['start'] : ""; ?>" size="6">
  <label for="end">end number</label>
(excl.)
<input name="end" type="text" value="<?php echo (isset($_POST['end'])) ? $_POST['end'] : ""; ?>" size="6">
  <input type="submit" name="Submit" value="Copy now!">
</form>
<p><?php echo $msg; ?></p>
</body>
</html>