Jump to content

resize the thumbnail pic


grandgefx

Recommended Posts

I want to resize both width and height of the thumb pic

 

this is the php code

<?php
$id_member=$_SESSION['rid'];
if(!empty($foto1_name))
    	{
	$nama_file=$foto1_name;
  	$anton->sekur_upload($nama_file);
  	if($valid)
    	      {
		  $abpath = "conf/i/";
     		  	  @copy($foto1, $abpath."/".$foto1_name);
		    $abang_dom=$abpath."/".$foto1_name;
				 list($width, $height) = getimagesize($abang_dom);
  					 if($width>200)
    					        {
						make_thumb("$abpath/$foto1_name","conf/i/thumb/$foto1_name",200);
					}
				        else
				 	{
  				   	$tujuan="conf/i/thumb/".$foto1_name;
   	  				rename($abang_dom, $tujuan);
  					}

	      }	

	$foto_old_name=$foto1_name;
	$foto1_name=$id_member."_".$foto1_name;
	$foto1_name=strtolower($foto1_name);
	$foto1_name=str_replace(' ', '', $foto1_name);
	$asal1="conf/i/".$foto_old_name;
	$asal2="conf/i/thumb/".$foto_old_name;	
	$tujuan1="conf/i/".$foto1_name;
	$tujuan2="conf/i/thumb/".$foto1_name;
             	rename($asal1, $tujuan1);
   	rename($asal2, $tujuan2);

                 }

 

I want to set the size to 100 x 100, which part of the code that I need to edit?

Link to comment
https://forums.phpfreaks.com/topic/255654-resize-the-thumbnail-pic/
Share on other sites

Unless you are starting with a square image, resizing BOTH height & width to 100, will result in a distorted image. You will most likely, need to CROP to a square then resize.

 

cropping ... http://www.nstoia.com/sat/crop/

resizing ...  http://www.nstoia.com/sat/resize/

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.