Sir
i want to resize image. Following script working in my local server. But This coding doesn't work in php 2.6.0. please help me
[code=php]
<form action="<?php echo $_server['php-self']; ?>" method="post" enctype="multip art/form-data" id="something" class="uniForm" >
<input name="new_image " id="new_image" size="30" type="file" class="fileUplo ad" />
<button name="submit" type="submit" class="submitBu tton">Upload/Resize Image</button>
</form>
<?php
if(isset($_POST['submit'])){
if (isset ($_FILES["new_image"])){
$imagename = $_FILES["new_image"]["name"];
$source = $_FILES["new_image"]["tmp_name"];
$target = "images/".$imagenam e;
//$prefix = 'small_';
move_uploaded_f ile($source, $target);
$imagepath = $imagename;
$save = "images/sml_" . $imagepath; //This is the new file you saving
$file = "images/" . $imagepath; //This is the original file
list($width, $height) = getimagesize($f ile) ;
$modwidth = 150;
$diff = $width / $modwidth;
$modheight = $height / $diff;
$tn = imagecreatetrue color($modwidth , $modheight) ;
$image = imagecreatefrom jpeg($file) ;
imagecopyresamp led($tn, $image, 0, 0, 0, 0, $modwidth, $modheight, $width, $height) ;
imagejpeg($tn, $save, 100) ;
$save = "images/sml_" . $imagepath; //This is the new file you saving
$file = "images/" . $imagepath; //This is the original file
list($width, $height) = getimagesize($f ile) ;
$modwidth = 80;
$diff = $width / $modwidth;
$modheight = $height / $diff;
$tn = imagecreatetrue color($modwidth , $modheight) ;
$image = imagecreatefrom jpeg($file) ;
imagecopyresamp led($tn, $image, 0, 0, 0, 0, $modwidth, $modheight, $width, $height) ;
imagejpeg($tn, $save, 100) ;
echo "Large image: <img src='images/".$imagepath."' ><br>";
echo "Thumbnail: <img src='images/sml_".$imagepat h."'>";
}
}
?>
[/code]
i want to resize image. Following script working in my local server. But This coding doesn't work in php 2.6.0. please help me
[code=php]
<form action="<?php echo $_server['php-self']; ?>" method="post" enctype="multip art/form-data" id="something" class="uniForm" >
<input name="new_image " id="new_image" size="30" type="file" class="fileUplo ad" />
<button name="submit" type="submit" class="submitBu tton">Upload/Resize Image</button>
</form>
<?php
if(isset($_POST['submit'])){
if (isset ($_FILES["new_image"])){
$imagename = $_FILES["new_image"]["name"];
$source = $_FILES["new_image"]["tmp_name"];
$target = "images/".$imagenam e;
//$prefix = 'small_';
move_uploaded_f ile($source, $target);
$imagepath = $imagename;
$save = "images/sml_" . $imagepath; //This is the new file you saving
$file = "images/" . $imagepath; //This is the original file
list($width, $height) = getimagesize($f ile) ;
$modwidth = 150;
$diff = $width / $modwidth;
$modheight = $height / $diff;
$tn = imagecreatetrue color($modwidth , $modheight) ;
$image = imagecreatefrom jpeg($file) ;
imagecopyresamp led($tn, $image, 0, 0, 0, 0, $modwidth, $modheight, $width, $height) ;
imagejpeg($tn, $save, 100) ;
$save = "images/sml_" . $imagepath; //This is the new file you saving
$file = "images/" . $imagepath; //This is the original file
list($width, $height) = getimagesize($f ile) ;
$modwidth = 80;
$diff = $width / $modwidth;
$modheight = $height / $diff;
$tn = imagecreatetrue color($modwidth , $modheight) ;
$image = imagecreatefrom jpeg($file) ;
imagecopyresamp led($tn, $image, 0, 0, 0, 0, $modwidth, $modheight, $width, $height) ;
imagejpeg($tn, $save, 100) ;
echo "Large image: <img src='images/".$imagepath."' ><br>";
echo "Thumbnail: <img src='images/sml_".$imagepat h."'>";
}
}
?>
[/code]
Comment