All pastes #80572 Raw Edit

Mine

public text v1 · immutable
·published 2006-07-06 15:34 UTC
rendered paste body
<?php
//============================================
//
//============================================
class Galeri
{

	//========================================================================
	// CONSTRUCTOR
	//========================================================================
	function Galeri()
	{
		global $tema;
		global $db;
        global $dil;
        global $lang;

		$this->_tema = $tema;
        $this->_db = $db;
        $this->_dil = $dil;
        $this->_lang = $lang;
	}

    //========================================================================
	// KÜÇÜK RES&#304;M GÖRÜNTÜSÜ OLU&#350;TUR
	//========================================================================
    function Thumb($image,$w,$h) {

        $image_data = imagecreatefromjpeg($image);


        // Original width && height
        $width  = imagesx($image_data);
        $height = imagesy($image_data);

        // create
        $new = imagecreatetruecolor($w, $h);
        imagecopyresampled($new, $image_data, 0, 0, 0, 0, $w, $h, $width, $height);

        // Finally, output..
        $image_data = imagejpeg($new);


        // Flush memory
        imagedestroy($image_data);
        imagedestroy($new);

    }
    
    //========================================================================
	// EKLENM&#304;&#350; GALER&#304; GÖSTER&#304;R
	//========================================================================
    function GaleriGoster($id,$template,$limit){

        if($limit==0){
            $limitle = "LIMIT $limit";
        } else {
            $limitle = "";
        }
        
        $query = $db->Query("SELECT * FROM " . PREFIX . "_galeriresim WHERE galeriid = $id AND dil ='".$this->_dil."' ORDER BY sira $limitle");

        $t_width = 140;
        $t_height = 100;

        $galeri = array();
        while ($resim = $query->fetchrow()) {

            $resim->thumblink = "index.php?sayfa=galeri&amp;bolum=resimdetay&amp;resimid=" . $resim->resimid . "";
            $resim->thumbyarat = $this->thumb($resim->yol,$t_width,$t_height);

            array_push($galeri, $resim);
        }
        $this->_tema->assign('galeri', $galeri);
        $this->_tema->assign('lang', $this->_lang);

        $pre_tpl = $this->_tema->fetch($template);
    }



}
?>