html - I want to change image size while uploading it in php -


so trying build uploading page big size videos in want reduce thumbnail size load fast if size 100 or 200kb of image (thumbnail). here html code of uploading:

<form method="post" enctype="multipart/form-data" class="form-horizontal">  	                  <tr>      	<td><label class="control-label"><h4>name</h4></label></td>          <td><input class="form-control" type="text" name="name" placeholder="file name" required autocomplete="off" /></td>      </tr>                        <tr>      	<td><label class="control-label"><h4>video file</h4></label></td>          <td>          	<input type="file" class="updatechoose" name="uploadvideo" required autocomplete="off" />          </td>      </tr>        	<tr>      	<td><label class="control-label"><h4>thumbnail</h4></label></td>          <td>          	<input type="file" class="updatechoose" name="image" required autocomplete="off" />          </td>      </tr>  	  	<tr>     		<td><label class="control-label"><h4>type</h4></label></td>	  <td>			    <h4><select  class="styled-select slate" name="type" <option  value=''>    <option value="type">select type</option>            <option value="movie">movie</option>      <option value="tvshow">tvshow</option>  	 <option value="video/trailer">video/trailer</option>  	  <option value="songs">songs</option>      <option value="other/porn">other/porn</option>    </select></h4>  </td>  						  						</tr>  	  	<tr>  	<td><label class="control-label"><h4>description:</h4></label></td>	  	<td>  	<div class="box" >  		<textarea  placeholder="give short description video.!!" name="description" required=" "></textarea>  		</div>  </td>      </tr>    <tr>  	       	<td><h4>tags</h4></td><td>  	  		<input name="tags" id="mysinglefield" class="form-control"  value="" disabled="true" type="hidden">  		<ul class="form-control" id="singlefieldtags"></ul>  		    	  	  	  	      <script>          $(function(){              var country_list = ;                  availabletags: country_list,                  // make tag-it submit single form value, comma-delimited field.                  singlefield: true,                  singlefieldnode: $('#mysinglefield'),  				allowspaces: true              });  			  			//-------------------------------              // read              //-------------------------------              $('#readonlytags').tagit({                  readonly: true              });  		});      </script>      </div>	  	</td>  	  	      </tr>          <tr>          <td colspan="2"><button type="submit" name="upload" class="updatebutton">          <span class="glyphicon glyphicon-upload"></span> upload          </button>  		                                       </td>      </tr>            </table>       </form>
trying build uploading page big size videos in want reduce thumbnail size load fast if size 100 or 200kb of image (thumbnail).

here php code of uploading:

<?php  include 'db.php';  require_once 'dbconfig.php';  if (isset($_request['upload']))  	  {    $time= date("y-m-d h:i:s");  $name = $_post['name'];//  name	  $type = $_post['type'];  $description = $_post['description'];//  name	  $tags = $_post['tags'];//  name	        $videoname=$_files['uploadvideo']['name'];   $videotype=$_files['uploadvideo']['type'];  $videosize=$_files['uploadvideo']['size'];      $cname=str_replace(" ","_",$videoname);  $tmp_name=$_files['uploadvideo']['tmp_name'];  $target_path="uploaded/";  $vidext = strtolower(pathinfo($videoname,pathinfo_extension)); // image extension  		  			// valid image extensions  			$valid_extensions = array('mkv', 'mkv', 'mp4', 'mp4','avi','avi'); // valid extensions  		  			// rename uploading image  			$videoname = rand(1000,1000000).".".$vidext;  				  			// allow valid image file formats  			if(in_array($vidext, $valid_extensions)){			  				  					if($videosize < 5000000000)	{  					move_uploaded_file($tmp_name,$target_path.$videoname);  					  				}  				else{  					$errmsg = "sorry, file large.";  				}  			}  			else{  				$errmsg = "sorry, mkv , mp4, avi,mp4 files allowed.";		  			}    	  $image=$_files['image']['name'];   $imagetype=$_files['image']['type'];  $imagesize=$_files['image']['size'];    	  $image=str_replace(" ","_",$image);	  $tmp_name=$_files['image']['tmp_name'];  $target_path="timages/";  $imgext = strtolower(pathinfo($image,pathinfo_extension)); // image extension  		  			// valid image extensions  			$valid_extensions = array('jpeg', 'jpg', 'png'); // valid extensions  		  			// rename uploading image  			$image = rand(1000,1000000).".".$imgext;  				  			// allow valid image file formats  			if(in_array($imgext, $valid_extensions)){			  				  						{  					move_uploaded_file($tmp_name,$target_path.$image);  				}  				  			}  			else{  				$errmsg = "sorry, jpg, jpeg, png  files allowed.";		  			}    {    $session = $_session['usersession'];  	$url = "uploaded/$videoname ";  	$upload= mysqli_query($conn, "insert video(session,time,name,description,videoname,image,type,tags,videosize,imagesize,videotype,imagetype,url) values('$session', '$time', '$name','$description', '$videoname','$image','$type','$tags','$videosize','$imagesize','$videotype','$imagetype','$url')");    	if($upload)  	{  				$successmsg = "your video ' ".$name." ' has been uploaded , <a  target='_blank'   href='uploaded.php'>view</a>.";  				  				 // redirects video view page after 5 seconds.  			}  			else  			{  				$errmsg = "error while inserting....";  			}  }  }  ?>


Comments

Popular posts from this blog

resizing Telegram inline keyboard -

command line - How can a Python program background itself? -

php - "cURL error 28: Resolving timed out" on Wordpress on Azure App Service on Linux -