Example #1
0
                                            </p>
                                        </div>
				   </div>
				</div>
				<?php 
    }
    $imagename = "";
    while ($rallpic = $qallpics->fetch()) {
        $i++;
        $imagename = "foldername" . $i;
        $albumimage = $rallpic['pic'];
        if ($albumimage != '') {
            $thumbnail = "thumbnail/sample_pic{$i}.jpg";
            $largeimage = "thumbnail/large_pic{$i}.jpg";
            create_square_image("../{$albumimage}", $thumbnail, 180);
            create_square_image("../{$albumimage}", $largeimage, 600);
            $galleryimage = $thumbnail;
            $largepic = $largeimage;
        } else {
            $galleryimage = '../' . $albumimage;
            $largepic = '../' . $albumimage;
        }
        ?>
				<div class="imgcon1" style="<?php 
        if ($i % 5 == 0) {
            echo 'margin-right:0px;';
        }
        ?>
">
					 <a href="#<?php 
        echo $imagename;
Example #2
0
            $rsh = $qsh->fetch();
            $qallrev = $db->query("SELECT sum(`overall`)/COUNT(`id`) as avgrat,COUNT(`id`) as cnt  FROM  `vendor_review` WHERE did={$rven['id']}");
            $rallrev = $qallrev->fetch();
            $totalavg = $rallrev['avgrat'] * (100 / 5);
            $totalreview = $rallrev['cnt'];
            $catidval = $rven['category'];
            $qshcat = $db->prepare('select * from   category where `slno`=?');
            $qshcat->execute(array($catidval));
            $rshcat = $qshcat->fetch();
            //image croping
            $largeimage = end(explode("/", $rven['image']));
            $largeimage = explode(".", $largeimage);
            $ext = end(explode(".", $rven['image']));
            $thumbnail = "thumb/{$largeimage['0']}_thumb.{$ext}";
            if (!file_exists($thumbnail)) {
                create_square_image($rven['image'], $thumbnail, 150);
            }
            ?>
				    
                                    <div class="hotel" style="position:relative;<?php 
            if ($j % 2 == 0) {
                echo 'margin-right: 0px';
            }
            ?>
">
                                            <div class="hotel_contentimg">
                                              <img src="<?php 
            echo $thumbnail;
            ?>
" class="venu_img"/>
                                            
        // save the smaller image FILE if destination file given
        if (substr_count(strtolower($destination_file), ".jpg")) {
            imagejpeg($square_image, $destination_file, 100);
        }
        if (substr_count(strtolower($destination_file), ".gif")) {
            imagegif($square_image, $destination_file);
        }
        if (substr_count(strtolower($destination_file), ".png")) {
            imagepng($square_image, $destination_file, 9);
        }
        imagedestroy($original_image);
        imagedestroy($smaller_image);
        imagedestroy($square_image);
    }
}
// in your php pages create images with a code like this:
// create_square_image("sample.jpg","sample_thumb.jpg",200);
// first parameter is the name of the image file to resize
// second parameter is the path where you would like to save the new square thumb, e.g. "sample_thumb.jpg" or just "NULL" if you do not want to save new image. If NULL then this file should be used as the "src" of the image. Folder whre you save image has to be writable, "777" permission code on most servers.
// 200 is the size of the new square thumb
create_square_image("../upload/1441276086Working out together bonds couples.jpg", "sample_thumb.jpg", 200);
?>

<h2>Original image</h2>
<h2><img src="../upload/1441276086Working out together bonds couples.jpg" />
</h2>

<h2>The created square thumbnail</h2>
<h2><img src="sample_thumb.jpg" />
</h2>
Example #4
0
            $img = 'luck.png';
        } elseif ($type == 'Friends') {
            $img = 'luck1.png';
        } elseif ($type == 'Everyone') {
            $img = 'luck2.png';
        }
        if ($rallalbum['image'] != '') {
            $albumimage = $rallalbum['image'];
        } else {
            $albumimage = $rtotal1['pic'];
        }
        if ($type != 'Locked') {
            $i++;
            if ($albumimage != '') {
                $thumbnail = "thumbnail/sample_thumb{$i}.jpg";
                create_square_image("../{$albumimage}", $thumbnail, 270);
                $galleryimage = "template/{$thumbnail}";
            } else {
                $galleryimage = '../' . $albumimage;
            }
            ?>
			   <div class="imgcon" style="<?php 
            if ($i % 3 == 0) {
                echo 'margin-right:0px;';
            }
            ?>
">
			   <div style="width:100%; height: auto; float: left;">
			    <table style="width: 100%; height: 100%;">
				<tr>
				    <td style="vertical-align: middle;"><img src="<?php 
Example #5
0
 function create_square_thumbnail_image($source_image_path, $side_length, $force_create = false)
 {
     if (!file_exists($source_image_path)) {
         return NULL;
     }
     $square_image_path = create_square_image($source_image_path, $force_create);
     if (!$square_image_path) {
         return NULL;
     }
     return create_resized_image($square_image_path, $side_length, $force_create);
 }