PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Tuesday, October 11, 2022

[FIXED] how can i automatically create thumbnail images from an uploaded file With GD library

 October 11, 2022     ajax, gd, jquery, php     No comments   

Issue

how can i create automatically tumbling .. I need when i upload original image automatically create thumb and add thumb ( size 200 x 200 ) in folder and insert path of thumb in database $thumb .. i need help .. any one can help me ?

    <?php
error_reporting(0);
if ($_POST['submit'])
{
  $name=basename($_FILES['file_upload']['name']);   
  $t_name=$_FILES['file_upload']['tmp_name'];
  $dir='upload';
  $image_title=$_POST['image_title'];
  $image_details=$_POST['image_details'];
  $image_text=$_POST['image_text'];
  $cat=$_POST['cat'];
  $thumb=$_POST['thumb'];

if(move_uploaded_file($t_name,$dir."/".$name))
   {
mysql_select_db ($db_name,$conn);
$qur="insert into images (mid, cid, name, path, image_title, image_details, image_text, thumb, addGby, addGon) 
values('','$cat','$name','upload/$name','$image_title','$image_details','$image_text','$thumb','$session_name',now())";
$res=mysql_query($qur,$conn);
echo 'File Upload sussfully';
}
else
{
echo 'upload filed!';
}
}
?>



<form method="post" action="Addgallery.php" enctype="multipart/form-data">

<div class="field">
<label>image : </label>
<input type="file" class="custom-file-input" name="file_upload" id="file_upload"  />
</div>

<div class="field fullwidth last">
<input type="submit" name="submit" value="upload" class="bt blue large"  />
</div>
</form>

Solution

You should try imgBrowz0r http://freecode.com/projects/imgbrowz0r It is a php-written plugin

Css-tricks also have a tutorial on it.



Answered By - Alfred Larsson
Answer Checked By - Candace Johnson (PHPFixing Volunteer)
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing