Este es el mensaje:
Warning: imagecolorsforindex() [function.imagecolorsforindex]: Color index -1 out of range in C:\xampp\htdocs\educador\admin\upload.class.php on line 105
upload.class.php
Código PHP:
Ver original
<?php class upload { var $directory_name; var $max_filesize; var $error; var $user_tmp_name; var $user_file_name; var $user_file_size; var $user_file_type; var $user_full_name; var $thumb_name; function set_directory($dir_name = "") { $this->directory_name = $dir_name; } function set_max_size($max_file = 300000) { $this->max_filesize = $max_file; } function error() { return $this->error; } function is_ok() { return FALSE; else return TRUE; } function set_tmp_name($temp_name) { $this->user_tmp_name = $temp_name; } function set_file_size($file_size) { $this->user_file_size = $file_size; } function set_file_type($file_type) { $this->user_file_type = $file_type; } function set_file_name($file) { $this->user_file_name = $file; $this->user_full_name = $this->directory_name."/".$this->user_file_name; } function resize($max_width = 0, $max_height = 0 ) { { } { } { } { $new_width = $max_width; $new_height = $max_height; } { $new_width = $max_width; $new_height = ((int)($new_width * $FullImage_height) / $FullImage_width); } { $new_height = $max_height; $new_width = ((int)($new_height * $FullImage_width) / $FullImage_height); } else { $new_height = $FullImage_height; $new_width = $FullImage_width; } // Check transparent gif and pngs { $trnprt_indx = imagecolorallocate($full_id, $trnprt_color['red'], $trnprt_color['green'], $trnprt_color['blue']); } imagecopyresampled( $full_id, $img, 0,0,0,0, $new_width, $new_height, $FullImage_width, $FullImage_height ); { } { } { } } function start_copy() { $this->error = "You must define filename!"; if ($this->user_file_size <= 0) $this->error = "File size error (0): $this->user_file_size KB<br>"; if ($this->user_file_size > $this->max_filesize) $this->error = "File size error (1): $this->user_file_size KB<br>"; { $destination = $this->user_full_name; else $destination = $filename; $this->error = "File ".$this->user_tmp_name." is not uploaded correctly."; $this->error = "Impossible to copy ".$this->user_file_name." from $userfile to destination directory."; } } function set_thumbnail_name($thumbname) { $this->thumb_name = $this->directory_name."/".$thumbname; $this->thumb_name = $this->directory_name."/".$thumbname; $this->thumb_name = $this->directory_name."/".$thumbname; } function create_thumbnail() { { echo "<br>".$this->user_full_name.", ".$this->thumb_name."<br>"; echo "failed to copy $file...<br />\n"; } } function set_thumbnail_size($max_width = 0, $max_height = 0 ) { { } { } { } { $new_width = $max_width; $new_height = $max_height; } { $new_width = $max_width; $new_height = ((int)($new_width * $FullImage_height) / $FullImage_width); } { $new_height = $max_height; $new_width = ((int)($new_height * $FullImage_width) / $FullImage_height); } else { $new_height = $FullImage_height; $new_width = $FullImage_width; } // Check transparent gif and pngs { $trnprt_indx = imagecolorallocate($full_id, $trnprt_color['red'], $trnprt_color['green'], $trnprt_color['blue']); } ImageCopyResampled ( $full_id, $img, 0,0,0,0, $new_width, $new_height, $FullImage_width, $FullImage_height ); { } { } { } } } ?>