0
폴더에서 이미지를 가져오고 이미지를 입력 파일없이 다른 폴더에 업로드하고 싶습니까? 하지만 난 입력하지 않고 다른 폴더에 영화 쇼핑 카트 제품 이미지에 지금 내가 원하는 관리/업로드에서폴더에서 이미지를 가져오고 이미지를 입력 파일없이 다른 폴더에 업로드하고 싶습니까?
<?php
$size = 200; // the thumbnail height
$filedir = 'uploads/'; // the directory for the original image
$thumbdir = 'uploads/'; // the directory for the thumbnail image
$prefix = 'small0_'; // the prefix to be added to the original name
$maxfile = '2000000';
$mode = '0666';
$rnd_1 = rand(11111,99999);
$userfile_name= $rnd_1.'_'.$_FILES['image']["name"];
$userfile_tmp = $_FILES['image']['tmp_name'];
$userfile_size = $_FILES['image']['size'];
$userfile_type = $_FILES['image']['type'];
if (isset($_FILES['image']['name']))
{
$prod_img = $filedir.$userfile_name;
$prod_img_thumb = $thumbdir.$prefix.$userfile_name;
move_uploaded_file($userfile_tmp, $prod_img);
chmod ($prod_img, octdec($mode));
$sizes = getimagesize($prod_img);
$aspect_ratio = $sizes[1]/$sizes[0];
if ($sizes[1] <= $size)
{
$new_width = '500';
$new_height = '500';
}else{
$new_width = '500';
$new_height = '500';
}
$destimg=ImageCreateTrueColor($new_width,$new_height)
or die('Problem In Creating image');
$srcimg=ImageCreateFromJPEG($prod_img)
or $srcimg=ImageCreateFromPNG($prod_img)
or $srcimg=ImageCreateFromGIF($prod_img)
or die('Problem In opening Source Image0');
if(function_exists('imagecopyresampled'))
{
imagecopyresampled($destimg,$srcimg,0,0,0,0,$new_width,$new_height,ImageSX($srcimg),ImageSY($srcimg))
or die('Problem In resizing');
}else{
Imagecopyresized($destimg,$srcimg,0,0,0,0,$new_width,$new_height,ImageSX($srcimg),ImageSY($srcimg))
or die('Problem In resizing');
}
ImageJPEG($destimg,$prod_img_thumb,90)
or die('Problem In saving');
}
?>
<img name="image" id="image" src="admin/uploads/small0_<?php echo $image?>" width="150" height="150">
내게 얻기 이미지 내 페이지 코드 여기
이제 관리/업로드에서 이미지를 얻고있다 형식 파일
다른 폴더에 업로드하고 싶습니다 ... –
당신이'move_uploaded_file'을 호출하는 것을 봅니다. 올바른 폴더로 옮기지 않습니까? –
이 스크립트는 관리자 패널로 작동하지만 입력 파일이 있지만이 입력 스크립트가 장바구니 페이지에서 입력 파일없이 작동하게하려면 –