런타임에 이미지를 미리 볼 수 있습니까? 업 로더 스크립트 및 크기 조정 기능이 있습니다.하지만 런타임에 이미지가 표시되지 않습니다 .iamge를 저장하려고하지 않습니다. 실행 time.Image에서 쇼 .I 이런 식으로 뭔가를 시도하고 있었다하지 디렉토리에서 메모리에서 제시해야합니다 :런타임에 이미지 크기 조정 PHP
if ($_FILES['myfile']['error'] == 0)
{
$theImageToResize=$_FILES['myfile']['name'];
$afterResize=Resize($theImageToResize);
echo $theImageToResize.'---->image after resize';
}
[바로 Directory에서 memory.Not에서 이미지를 표시 할]
서버 측 코드 :
$savefolder = 'images'; //upload dir
$max_size = 35000; //in bytes
// image types
$allowtype = array('bmp', 'gif', 'jpg', 'jpeg', 'gif', 'png');
$res = '';
// if is received a valid file
if (isset ($_FILES['myfile'])) {
$type = end(explode(".", strtolower($_FILES['myfile']['name'])));
if (in_array($type, $allowtype)) {
if ($_FILES['myfile']['size']<=$max_size*1000) {
if ($_FILES['myfile']['error'] == 0) {
$thefile = $savefolder . "/" . $_FILES['myfile']['name'];
$theImageToResize=$_FILES['myfile']['name'];
header('Content-type: image/jpeg');
$res = '<img src="'.$theImageToResize.'" />';
}
}
else { $res = 'The file <b>'. $_FILES['myfile']['name']. '</b> exceeds max Size <i>'. $max_size. 'KB</i>'; }
}
else { $res = 'The file <b>'. $_FILES['myfile']['name']. '</b> has not an allowed File Tyle..'; }
}
$res = urlencode($res);
echo '<body onload="parent.doneloading(\''.$res.'\')"></body>';
과 같은 적절한 헤더를 잊지 마세요. 저는 당신에게 자바 스크립트로 이것을 할 것입니다. – markus