Jump to content

Recommended Posts

I am trying to upload a image, then resize it.

 

here is my error: Fatal error: Call to undefined function imagecopyresampled() in /var/www/krazypicks/admin_area/foot/new_foot_bowl_proc.php on line 32

 

here is line 32:

$file = "bowls_img/" . $imagepath; //This is the original file

 

here is the entire script:

<?php
ob_start();
$path = "../../";
$title = "Create Football Bowls";
$rank = "yes";
$u_login = "yes";
$admin = "yes";
include ($path."main/include/cons/head.php");

$counter = $_SESSION['counter'];
   for ($counter = 1; $counter <= $num; $counter++) { 
   //Image Settings!

              $imagename = $_FILES['image-'.$counter]['name'];
              $source = $_FILES['image-'.$counter]['tmp_name'];
              $target = "bowls_img/".$imagename;
              move_uploaded_file($source, $target);

              $imagepath = $imagename;
              $save = "bowls_img/" . $imagepath; //This is the new file you saving
              $file = "bowls_img/" . $imagepath; //This is the original file
              $modwith = $twidth;
		  $modheight = $theight;

              $tn = imagecreatetruecolor($modwidth, $modheight) ; 
              $image = imagecreatefromjpeg($file) ; 
              imagecopyresampled($tn, $image, 0, 0, 0, 0, $modwidth, $modheight, $width, $height) ; 

              imagejpeg($tn, $save, 100) ; 

              $save = "ibowls_img/sml_" . $imagepath; //This is the new file you saving
              $file = "bowls_img/" . $imagepath; //This is the original file

              list($width, $height) = getimagesize($file) ; 

              $modwidth = 80; 

              $diff = $width / $modwidth;

              $modheight = $height / $diff; 
              $tn = imagecreatetruecolor($modwidth, $modheight) ; 
              $image = imagecreatefromjpeg($file) ; 
              imagecopyresampled($tn, $image, 0, 0, 0, 0, $modwidth, $modheight, $width, $height) ; 

              imagejpeg($tn, $save, 100) ; 
            echo "Large image: <img src='bowls_img/".$imagepath."'><br>"; 
            echo "Thumbnail: <img src='bowls_img/sml_".$imagepath."'>"; 



echo $name."<br>";
  if($name == ("")){
  $image = "main/style/img/b_default.jpg";
}else{
  $image = "admin_area/foot/bowls_img/".$name;
}
echo $image;
  $id = $counter;
  $name = $_POST['name-'.$counter];
  $ta = $_POST['ta-'.$counter];
  $tb = $_POST['tb-'.$counter];
  $pnt = $_POST['pnt_val'.$counter];
  $date = $_POST['date-'.$counter];
  $time = $_POST['time-'.$counter];
  $network = $_POST['net-'.$counter];
  $place = $_POST['place-'.$counter];
  $rank_a = $_POST['rna-'.$counter];
  $rec_a = $_POST['ra-'.$counter];
  $rank_b = $_POST['rnb-'.$counter];
  $rec_b = $_POST['rb-'.$counter];
  
  $query = "INSERT INTO `foot_bowls` (id, name, pnt_val, team_a, team_b, image, date, time, network, place, rank_a, rank_b, rec_a, rec_b) VALUES ('".$id."', '".$name."', '".$pnt."', '".$ta."', '".$tb."', '".$image."', '".$date."', '".$time."', '".$network."', '".$place."', '".$rank_a."', '".$rank_b."', '".$rec_a."', '".$rec_b."')";
  mysql_query($query)or die(mysql_error());
  }//end loop
  echo "<br>All Done!";
  echo "<br>Proccessed ".$id." number of forms";
include ($path."main/include/cons/foot.php");
?>

 

Any Ideas?

Link to comment
https://forums.phpfreaks.com/topic/136919-images/
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.