0

我如何创建自动翻滚..我需要在上传原始图像时自动创建拇指并在文件夹中添加拇指(大小 200 x 200)并在数据库 $thumb 中插入拇指路径..我需要帮助..任何人都可以帮助我?

    <?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>
4

2 回答 2

2

如果您不想编写自己的代码,请尝试这些

http://phpthumb.sourceforge.net/

http://davidwalsh.name/create-image-thumbnail-php

http://webcheatsheet.com/php/create_thumbnail_images.php

于 2012-05-31T15:56:49.393 回答
0

你应该试试 imgBrowz0r http://freecode.com/projects/imgbrowz0r 这是一个 php 编写的插件

Css-tricks 也有关于它的教程。

于 2012-05-31T15:56:01.333 回答