...

View Full Version : resize the thumbnail pic



grandgefx
01-24-2012, 04:27 AM
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?

BluePanther
01-24-2012, 04:57 AM
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?

Hard to say without knowing what the make_thumb function does, but an educated guess:


if($width>100)
{
make_thumb("$abpath/$foto1_name","conf/i/thumb/$foto1_name",100);

grandgefx
01-24-2012, 05:42 AM
Hard to say without knowing what the make_thumb function does, but an educated guess:


if($width>100)
{
make_thumb("$abpath/$foto1_name","conf/i/thumb/$foto1_name",100);


Hi I did that, but then it lined up the thumbnail pics vertically instead of horizontally, like it used to, why is that?

BluePanther
01-24-2012, 06:42 AM
Hi I did that, but then it lined up the thumbnail pics vertically instead of horizontally, like it used to, why is that?

Impossible to tell without knowing what make_thumb actually does. Probably just a CSS problem.

grandgefx
01-24-2012, 09:22 AM
Impossible to tell without knowing what make_thumb actually does. Probably just a CSS problem.

Hi can you point me how to find out what make_thumb does?

litebearer
01-24-2012, 01:01 PM
1. Unless your original images are square, resizing it to be square will result in distorted images. So you should also look into "cropping" the original before resizing.

2. You need to search thru the appropriate files for "function make_thumb(" to see how it is handling images



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum