Ejemplo n.º 1
0
 /**
  * Функция конструктор.
  * 
  * @param mixed $config  Настройки работы с изображениями
  */
 public function __construct($config = array())
 {
     if (!empty($config)) {
         self::$config = $config;
     }
     self::$temp = new RuntimeCache(array('Params' => array(), 'Size' => array()));
 }
Ejemplo n.º 2
0
function check_image($img_file)
{
    global $config;
    $maximgsize = explode('x', $config['imageautoresize']);
    $path_parts = pathinfo($img_file);
    $max_width = $maximgsize[0];
    $max_height = $maximgsize[1];
    $fil_scr_res = getimagesize(rawurldecode($img_file));
    if ($fil_scr_res[0] > $max_width || $fil_scr_res[1] > $max_height) {
        $n_img_file = $path_parts['dirname'] . '/resized_' . $path_parts['basename'];
        if (!file_exists($n_img_file)) {
            require_once 'includes/class.image.php';
            $img = new IMAGE();
            ob_start();
            $res = $img->send_thumbnail($img_file, $max_width, $max_height, true);
            $imgcontent = ob_get_contents();
            @ob_end_clean();
            if ($res && @($fp = fopen($n_img_file, 'w+'))) {
                fwrite($fp, $imgcontent);
                fclose($fp);
            } else {
                output_message('alert', 'Could not create preview!');
            }
        }
        $image = $n_img_file;
    } else {
        $image = $img_file;
    }
    return $image;
}
Ejemplo n.º 3
0
    ?>
	</table>
<?php 
}
// Similar Artist Map
if ($NumSimilar > 0) {
    if ($SimilarData = $Cache->get_value("similar_positions_{$ArtistID}")) {
        $Similar = new ARTISTS_SIMILAR($ArtistID, $Name);
        $Similar->load_data($SimilarData);
        if (!current($Similar->Artists)->NameLength) {
            unset($Similar);
        }
    }
    if (empty($Similar) || empty($Similar->Artists)) {
        include SERVER_ROOT . '/classes/image.class.php';
        $Img = new IMAGE();
        $Img->create(WIDTH, HEIGHT);
        $Img->color(255, 255, 255, 127);
        $Similar = new ARTISTS_SIMILAR($ArtistID, $Name);
        $Similar->set_up();
        $Similar->set_positions();
        $Similar->background_image();
        $SimilarData = $Similar->dump_data();
        $Cache->cache_value("similar_positions_{$ArtistID}", $SimilarData, 3600 * 24);
    }
    ?>
		<div id="similar_artist_map" class="box">
			<div id="flipper_head" class="head">
				<a href="#">&uarr;</a>&nbsp;
				<strong id="flipper_title">Similar Artist Map</strong>
				<a id="flip_to" class="brackets" href="#" onclick="flipView(); return false;">Switch to cloud</a>
Ejemplo n.º 4
0
 /**
  * Set the file name of the image to use.
  * @param string $url
  * @param boolean $load_image Loads original size from the image if
  * <code>True</code>. Turn off if you don't care about the initial size
  * and will simply set to fixed dimesions with {@link resize()}. Improves
  * speed in these cases (especially if the URL is external to the server).
  */
 public function set_url($url, $load_image = true)
 {
     $this->url = $url;
     if ($load_image) {
         $img = new IMAGE();
         $img->set_file($url);
         $this->set_image($img);
     } else {
         $this->original_width = 0;
         $this->original_height = 0;
     }
 }
Ejemplo n.º 5
0
 public function requestCacheFilename($params = null)
 {
     return '/' . IMAGE::getCacheFilename($params ? $params : $this->request->params);
 }
Ejemplo n.º 6
0
 public function __construct()
 {
     parent::__construct(false);
 }