3번째 옮깁니다. 아래 소스에서 최신 글 플래시도 출력 가능하게 좀 부탁드려요... > 그누4 질문답변

그누4 질문답변

그누보드4 관련 질문은 QA 로 이전됩니다. QA 그누보드4 바로가기
기존 게시물은 열람만 가능합니다.

3번째 옮깁니다. 아래 소스에서 최신 글 플래시도 출력 가능하게 좀 부탁드려요... 정보

3번째 옮깁니다. 아래 소스에서 최신 글 플래시도 출력 가능하게 좀 부탁드려요...

본문

오류가 나는곳의 주소를 알려주시면 더 빠르고 정확하게 답변 받을 수 있습니다.

오류 주소 :

<?php

function make_thumbnail($exist, $creat, $width, $height, $default = null)
{
global $g4;
if(file_exists($exist) == true && in_array(strtolower(array_pop(explode('.', $exist))), array('gif', 'jpg', 'jpeg', 'png')) == true)
{
if(file_exists($creat) == false)
{
list($img['width'], $img['height'], $img['type']) = getimagesize($exist);
switch($img['type'])
{
case '1' :

$src['image'] = imagecreatefromgif($exist);
$dst['image'] = imagecreate($width, $height);
break;

case '2' :

$src['image'] = imagecreatefromjpeg($exist);
$dst['image'] = imagecreatetruecolor($width, $height);
break;

case '3' :

$src['image'] = imagecreatefrompng($exist);
$dst['image'] = imagecreatetruecolor($width, $height);
break;
}
$dst['color'] = imagecolorallocate($dst['image'], 255, 255, 255);
imagefilledrectangle($dst['image'], 0, 0, $width, $height, $dst['color']);
imagecopyresampled($dst['image'], $src['image'], 0, 0, 0, 0, $width, $height, $img['width'], $img['height']);
switch($img['type'])
{
case '1' :

imagegif($dst['image'], $creat);
break;

case '2' :

imagejpeg($dst['image'], $creat, 100);
break;

case '3' :

imagepng($dst['image'], $creat, 100);
break;
}
imagedestroy($src['image']);
imagedestroy($dst['image']);
}
$return = "<img src=\"{$creat}\">";
}

else
{
$return = $default;
}

return $return;
}

?>

위 소스에

if(preg_match("/\.(swf|wma|asf)$/i","$file") && file_exists($file))
$img = "<script>doc_write(flash_movie('$file', 'flash$i', '$img_width', '$img_height', 'transparent'));</script>";

만약 플래시 파일이면 플래시 파일로 출력할려고 해도 ... 도저히 까막눈에는 방법이 보이질 않네요..

몇개 비교해 보았지만 실패했습니다.

도움 주시기 바랍니다.
  • 복사

댓글 전체

<?php
function make_thumbnail($exist, $creat, $width, $height, $default = null)
{
global $g4;

if(file_exists($exist) == true && in_array(strtolower(array_pop(explode('.', $exist))), array('gif', 'jpg', 'jpeg', 'png')) == true)
{
if(file_exists($creat) == false)
{
list($img['width'], $img['height'], $img['type']) = getimagesize($exist);

switch($img['type'])
{
case '1' :
$src['image'] = imagecreatefromgif($exist);
$dst['image'] = imagecreate($width, $height);
break;

case '2' :
$src['image'] = imagecreatefromjpeg($exist);
$dst['image'] = imagecreatetruecolor($width, $height);
break;

case '3' :

$src['image'] = imagecreatefrompng($exist);
$dst['image'] = imagecreatetruecolor($width, $height);
break;
}
$dst['color'] = imagecolorallocate($dst['image'], 255, 255, 255);
imagefilledrectangle($dst['image'], 0, 0, $width, $height, $dst['color']);
imagecopyresampled($dst['image'], $src['image'], 0, 0, 0, 0, $width, $height, $img['width'], $img['height']);

switch($img['type'])
{
case '1' :
imagegif($dst['image'], $creat);
break;

case '2' :
imagejpeg($dst['image'], $creat, 100);
break;

case '3' :
imagepng($dst['image'], $creat, 100);
break;
}
imagedestroy($src['image']);
imagedestroy($dst['image']);
}
$return = "<img src=\"{$creat}\">";
}
// # 김선용 플래시 처리 : getimagesize 로 플래시파일을 점검하는게 정확하나 파일명에서 확장자로 해도 무방하므로..
else if(preg_match("/\.(swf|wma|asf)$/i", $exist) && file_exists($exist))
{
$type_arr = getimagesize($exist);
$flash_id = substr(md5(uniqid("")),0, 15); // 여러곳에서 사용시 중복방지
$return ="<script>doc_write(flash_movie('$exist', 'flash_{$flash_id}', '{$type_arr[0]}', '{$type_arr[1]}', 'transparent'));</script>";
}
else
$return = $default;

return $return;
}
?>
sjsjin 님 너무 감사합니다.

width와 height가 먹히지 않아 픽셀 수 넣고 마무리 지었습니다.

너무 너무 감사드립니다.  올 한해 정말 복 많이 받는 한해가 되길 기원합니다.

건강하세요..

}
$return = "<img src=\"{$creat}\">";
}
// # 김선용 플래시 처리 : getimagesize 로 플래시파일을 점검하는게 정확하나 파일명에서 확장자로 해도 무방하므로..
else if(preg_match("/\.(swf|wma|asf)$/i", $exist) && file_exists($exist))
{
$type_arr = getimagesize($exist);
$flash_id = substr(md5(uniqid("")),0, 15); // 여러곳에서 사용시 중복방지
$return ="<script>doc_write(flash_movie('$exist', 'flash_{$flash_id}', '100', '75', 'transparent'));</script>";
}
else
$return = $default;

return $return;
}

장소는 여기입니다... 부끄럽지만  http://onuri.nanzoa.com
© SIRSOFT
현재 페이지 제일 처음으로