[問題]安裝了虛擬形像 MOd, 但用不了相冊 ><

phpBB 2 MOD Support
無論是官方或非官方認證之外掛,安裝與使用問題討論。
(發表文章請按照公告格式發表,違者砍文)

版主: 版主管理群

主題已鎖定
Newhandme
星球普通子民
星球普通子民
文章: 9
註冊時間: 2004-08-16 00:44

[問題]安裝了虛擬形像 MOd, 但用不了相冊 ><

文章 Newhandme »

問題外掛 :虛擬形像 MOd
使用版本 : 2.0.10
作業系統 : Linux
MYSQL 版本 :4.0.12
網站位置 :
狀況描述 :

安裝了虛擬形像 MOd, 但用不了相冊 ><, 當按下保存相片 , 則出現以下error

代碼: 選擇全部

Fatal error: Call to undefined function: imagecreatefromgif() in /home1/micecity/public_html/Miso/facealbum.php on line 182
facealbum.php

代碼: 選擇全部

<?php
/**
 * @version 1.0
 * @author [飄在北京] <week9@263.net>
 * @write 2003-03-29
 * 社區虛擬形象系統\r
 * 版權所有: 飄在北京\r
 * http://www.week9.com
 */

error_reporting(7);
define('IN_PHPBB', 1);
$phpbb_root_path = "./";
require($phpbb_root_path . 'extension.inc');
include($phpbb_root_path . 'common.'.$phpEx);
require($phpbb_root_path."includes/functions_face.php");
$userdata = session_pagestart($user_ip, PAGE_FACE);
init_userprefs($userdata);

if ( !$userdata['session_logged_in'] )
{
	$redirect = ( isset($post_id) ) ? POST_POST_URL . "=$post_id" : POST_TOPIC_URL . "=$topic_id";
	$redirect .= ( isset($start) ) ? "&start=$start" : '';
	redirect(append_sid("login.$phpEx?redirect=viewtopic.$phpEx&$redirect", true));
}

if(!isset($_GET[action]) && !isset($_POST[action]))
{
	$action="showroom";
}

if ($action=="showroom") {
	//現實保存照片開始
	$albumcookie = $db->sql_query("SELECT * FROM week9_facealbum where userid = $userdata[user_id] order by albumtime DESC");\r
	$break = 1;
	while ($useralbum = $db->sql_fetchrow($albumcookie))
    {
		$userface = $useralbum[useralbum];
		//$week9face = "<img src=pic/$useralbum[useralbum]>";
		$week9face = "<img src=\"$useralbum[useralbum]\" border=\"0\" alt=\"Fly In Beijing\">";
        eval('$xiangpian .= "' . gettemplate('face_album_xiangpian') . '";');
		if ($break%4 == 0)
		{
			$huanhang = "</td></tr><tr><td>";
		}
		else
		{
			$huanhang = "";
		}
		$break++;
		$xiangpian = $xiangpian.$huanhang;
	}
	$db->sql_freeresult($albumcookie);
	//結束	
//##### phpbb templates #######
	$banklocation = ' -> <a href="'.append_sid("face.".$phpEx).'" class="nav">'.$lang['Face'].'</a>'.' -> <a href="'.append_sid("facealbum.".$phpEx).'" class="nav">相冊</a>';
	$template->set_filenames(array( 'body' => 'face_album.tpl'));
	$template->assign_vars(array(
		'BANKLOCATION' => $banklocation,
		'LEFT' => $left,
		'CENTER' => $xiangpian,
		'SITENAME'=>$board_config['sitename']
	));
//
// Start output of page
//
	include($phpbb_root_path . 'includes/page_header.' . $phpEx);

//
// Generate the page
//
	$template->pparse('body');
	include($phpbb_root_path . 'includes/page_tail.' . $phpEx);

}

/////////////////////添加相冊信息\r
if ($_GET[action] == "album")
{
	$alumcookie = "";
	$alumcookie =  $_COOKIE[tempequip];
	if ("" == $alumcookie)
	{
		message_die(GENERAL_MESSAGE,"變數錯誤! <a href=".getenv("HTTP_REFERER")." class=nav>返回</a>");
	}
	$usercookie = $alumcookie;
	$userbankmoney = $userdata[user_bank];
	$usernm = $userdata[username];
	$usermoney = $userdata[user_money];
	$allmoney = $userdata[user_money]+$userdata[user_bank];
	$gender = $userdata[user_gender];
	if ($gender == 1)
	{
		$usergender = "帥哥";	
	}
	elseif($gender == 2)
	{
		$usergender = "美女";	
	}
	else
	{
		message_die(GENERAL_MESSAGE,"你還沒有選擇性別,本功能需要用戶選擇性別,如果你要使用本功能,請你返回修改你的論壇性別! <a href=".getenv("HTTP_REFERER")." class=nav>返回</a>");
	}
	eval("\$left = \"".gettemplate('face_left')."\";");
	eval("\$center = \"".gettemplate('face_album_center')."\";");
//##### phpbb templates #######
	$template->set_filenames(array( 'body' => 'face_body.tpl'));
	$template->assign_vars(array(
		'LEFT' => $left,
		'CENTER' => $center,
		'SITENAME'=>$board_config['sitename']
	));
//
// Start output of page
//
	include($phpbb_root_path . 'includes/page_header.' . $phpEx);

//
// Generate the page
//
	$template->pparse('body');
	include($phpbb_root_path . 'includes/page_tail.' . $phpEx);
}

/////////////////////添加相冊信息\r
if ($_POST[action] == "savealbum")
{
	if(!extension_loaded("gd"))
	{
		message_die(GENERAL_MESSAGE,"主機沒安裝GD library <a href=".getenv("HTTP_REFERER")." class=nav>返回</a>");
	}
	$usercookie=$_POST[usercookie];
	$albumname=$_POST[albumname];
	$albumjianjie=$_POST[albumjianjie];
	if ($usercookie=="")
	{
		message_die(GENERAL_MESSAGE,"變數錯誤! <a href=".getenv("HTTP_REFERER")." class=nav>返回</a>");
	}

	$albumname = htmlspecialchars(addslashes($_REQUEST[albumname]));
	$albumjianjie = htmlspecialchars(addslashes($_REQUEST[albumjianjie]));

	if (("" == $albumname) or (strlen($albumname) > 50 ))
	{
		message_die(GENERAL_MESSAGE,"相片名稱錯誤或者為空! <a href=".getenv("HTTP_REFERER")." class=nav>返回</a>");
	}
	if (("" == $albumjianjie) or (strlen($albumjianjie) > 200 ))
	{
		message_die(GENERAL_MESSAGE,"相片簡介錯誤或者為空! <a href=".getenv("HTTP_REFERER")." class=nav>返回</a>");
	}
	$facesetinfo = $result = $db->sql_query("SELECT * FROM week9_faceset");
	if ($userdata[user_money] < $facesetinfo[beiyong])
	{
		message_die(GENERAL_MESSAGE,"你的金幣不夠!請賺夠了錢再來吧! <a href=".getenv("HTTP_REFERER")." class=nav>返回</a>");
	}

	$result = $db->sql_query("SELECT * FROM week9_faceset");
	$facesetinfo = $db->sql_fetchrow($result);
    $nr = $faceidrows[nr];
	if ($nr > 8)
	{
		message_die(GENERAL_MESSAGE,"你的相冊裏面的相片數量已經達到最大值8個,如果你還要保存請你刪除你的相冊裏面的不喜歡的形象! <a href=".getenv("HTTP_REFERER")." class=nav>返回</a>");
	}

	$dstidfer = imagecreatetruecolor(140,226);//This function was added in PHP 4.0.6 and requires GD 2.0.1 or later
	//$dstidfer = imagecreate(140,226); // GD 1.x版的gd 請使用這段語法

	$black = imagecolorallocate ($dstidfer, 0, 0,0);
	$white = imagecolorallocate($dstidfer, 255, 255, 255);
	imagefill($dstidfer, 0, 0, $white);
	$cookiearray = split('-', $usercookie);
	for ($i=1; $i<26; $i++)
	{
		if ($cookiearray[6] != '0')
		{
			$cookiearray[8] = '0';
			$cookiearray[9] = '0';
		}
		if($cookiearray[$i] != '0')
		{
			$pic = "images/face/".$i."/".$cookiearray[$i].".gif";
			$srcidfer = imagecreatefromgif($pic);
			imagecopyresized($dstidfer, $srcidfer, 0, 0, 0, 0, 140, 226, 140, 226);
		}			
	}
	$dt = date("YmdHms");
	$string = date("Y/m/d");
	$picpath = "pic/".$userdata[user_id]."_".$dt.".jpg";
	imagestring ($dstidfer, 2, 2, 2,  $string, $black);
	imagejpeg($dstidfer, "$picpath");
	imagedestroy($srcidfer);
	imagedestroy($dstidfer);
	$db->sql_query("INSERT INTO week9_facealbum (userid, useralbum, albumname, albumjianjie, albumtime) VALUES ('".$userdata[user_id]."', '$picpath', '$albumname', '$albumjianjie', '".time()."')");
    $db->sql_query("UPDATE phpbb_users SET user_money=user_money-$facesetinfo[beiyong] WHERE user_id=$userdata[user_id]");
	message_die(GENERAL_MESSAGE,"感謝您使用$board_config[sitename]提供的虛擬形象。相片保存成功! <a href=".append_sid("facealbum.$phpEx")." class=nav>相冊</a>");
}

/////////////////////刪除相冊資訊
if ($_GET[action] == "delalbum")
{
	if ($_GET[id]=="")
	{
		message_die(GENERAL_MESSAGE,"變數錯誤! <a href=".getenv("HTTP_REFERER")." class=nav>返回</a>");
	}
    $picrow = $result = $db->sql_query("SELECT * from week9_facealbum where id='$_GET[id]' and userid = $userdata[user_id]"); 
	$db->sql_query("DELETE from week9_facealbum where id='$_GET[id]' and userid = $userdata[user_id]");
	
	function delete_file($file)
	{ 
		$delete = @unlink($file); 
		clearstatcache();
		if (@file_exists($file))
		{
			$filesys = eregi_replace("/","\\\",$file); 
			$delete = @system("del $filesys");
			clearstatcache();
			if (@file_exists($file))
			{
				$delete = @chmod ($file, 0777); 
				$delete = @unlink($file); 
				$delete = @system("del $filesys");
			}
		 }
		 clearstatcache();
		 if (@file_exists($file))
		 {
			 return false;
		 }
		 else
		 {
			 return true;
		 }
	} 
	delete_file($picrow[useralbum]);	
	message_die(GENERAL_MESSAGE,"感謝您使用$board_config[sitename]提供的虛擬形象。相片刪除成功! <a href=".getenv("HTTP_REFERER")." class=nav>返回</a>");
}
?>
有大大可以教我解決這問題嗎 ^^"?
頭像
pc123
星球公民
星球公民
文章: 60
註冊時間: 2003-12-20 22:32
來自: 火星
聯繫:

[教學]

文章 pc123 »

原因是因為GD2的版本\r
因為版權問題
移除了GIF檔案的建立(imagecreatefromgif)

自己想辦法改成jpg或png吧
目前狀態:還是回不去火星.地球還是好危險.

----------------------------------------------------
●我的網站連結:倒了..
----------------------------------------------------
●我所使用的的linux版本:....火星專用版本.!!!???
●我所使用的的Freebsd版本:.5.4
----------------------------------------------------
Newhandme
星球普通子民
星球普通子民
文章: 9
註冊時間: 2004-08-16 00:44

文章 Newhandme »

謝謝大大的指導, 我笨笨的, 不知要如何改 >.<". 可否給點堤示 ^^"...
ps : 是否將 imagecreatetruecolor(140,226); 改成 imagecreatefromgif ^^???
頭像
pc123
星球公民
星球公民
文章: 60
註冊時間: 2003-12-20 22:32
來自: 火星
聯繫:

文章 pc123 »

= =|||
亂改喔...
改法(不保證成功)
---------------------------------------------------
把所有的imagecreatefromgif
改成png吧.....(imagecreatefromjpg)
再把
$pic = "images/face/".$i."/".$cookiearray[$i].".gif";
改成
$pic = "images/face/".$i."/".$cookiearray[$i].".jpg";

試試看吧\r
有問題再找我
目前狀態:還是回不去火星.地球還是好危險.

----------------------------------------------------
●我的網站連結:倒了..
----------------------------------------------------
●我所使用的的linux版本:....火星專用版本.!!!???
●我所使用的的Freebsd版本:.5.4
----------------------------------------------------
Newhandme
星球普通子民
星球普通子民
文章: 9
註冊時間: 2004-08-16 00:44

文章 Newhandme »

還是不行啊 >"<, 我將
$srcidfer = imagecreatefromgif($pic) 和 $pic = "images/face/".$i."/".$cookiearray[$i].".gif";
改成
$srcidfer = imagecreatefromjpg($pic); 和 $pic = "images/face/".$i."/".$cookiearray[$i].".jpg";
則出現Fatal error: Call to undefined function: imagecreatefromjpg() in /home1/micecity/public_html/Miso/facealbum.php on line 182
=o=""
頭像
pc123
星球公民
星球公民
文章: 60
註冊時間: 2003-12-20 22:32
來自: 火星
聯繫:

文章 pc123 »

ㄟ............請問你有裝GD嗎??@@

如果有:那就是我打錯\r
應該是imagecreatefromjpeg
= =
目前狀態:還是回不去火星.地球還是好危險.

----------------------------------------------------
●我的網站連結:倒了..
----------------------------------------------------
●我所使用的的linux版本:....火星專用版本.!!!???
●我所使用的的Freebsd版本:.5.4
----------------------------------------------------
Newhandme
星球普通子民
星球普通子民
文章: 9
註冊時間: 2004-08-16 00:44

文章 Newhandme »

也不行啊 >.<""....
出現以下 error :

代碼: 選擇全部

Warning: imagecreatefromjpeg(images/face/2/22.jpeg): failed to open stream: No such file or directory in /home1/micecity/public_html/Miso/facealbum.php on line 182

Warning: imagecopyresized(): supplied argument is not a valid Image resource in /home1/micecity/public_html/Miso/facealbum.php on line 183

Warning: imagecreatefromjpeg(images/face/6/007.jpeg): failed to open stream: No such file or directory in /home1/micecity/public_html/Miso/facealbum.php on line 182

Warning: imagecopyresized(): supplied argument is not a valid Image resource in /home1/micecity/public_html/Miso/facealbum.php on line 183

Warning: imagecreatefromjpeg(images/face/11/init.jpeg): failed to open stream: No such file or directory in /home1/micecity/public_html/Miso/facealbum.php on line 182

Warning: imagecopyresized(): supplied argument is not a valid Image resource in /home1/micecity/public_html/Miso/facealbum.php on line 183

Warning: imagecreatefromjpeg(images/face/13/init.jpeg): failed to open stream: No such file or directory in /home1/micecity/public_html/Miso/facealbum.php on line 182

Warning: imagecopyresized(): supplied argument is not a valid Image resource in /home1/micecity/public_html/Miso/facealbum.php on line 183

Warning: imagecreatefromjpeg(images/face/14/init.jpeg): failed to open stream: No such file or directory in /home1/micecity/public_html/Miso/facealbum.php on line 182

Warning: imagecopyresized(): supplied argument is not a valid Image resource in /home1/micecity/public_html/Miso/facealbum.php on line 183

Warning: imagecreatefromjpeg(images/face/18/init.jpeg): failed to open stream: No such file or directory in /home1/micecity/public_html/Miso/facealbum.php on line 182

Warning: imagecopyresized(): supplied argument is not a valid Image resource in /home1/micecity/public_html/Miso/facealbum.php on line 183

Warning: imagedestroy(): supplied argument is not a valid Image resource in /home1/micecity/public_html/Miso/facealbum.php on line 191

Warning: Cannot modify header information - headers already sent by (output started at /home1/micecity/public_html/Miso/facealbum.php:182) in /home1/micecity/public_html/Miso/includes/page_header.php on line 495

Warning: Cannot modify header information - headers already sent by (output started at /home1/micecity/public_html/Miso/facealbum.php:182) in /home1/micecity/public_html/Miso/includes/page_header.php on line 497

Warning: Cannot modify header information - headers already sent by (output started at /home1/micecity/public_html/Miso/facealbum.php:182) in /home1/micecity/public_html/Miso/includes/page_header.php on line 498 
我明天問一問網存供應商 @@" , 可能真的是沒裝 GD =o=""
頭像
pc123
星球公民
星球公民
文章: 60
註冊時間: 2003-12-20 22:32
來自: 火星
聯繫:

文章 pc123 »

出現那樣是因為.................找不到檔案...
看樣子GD有裝喔.....
好像是我交你了錯誤的改法耶= =
$pic = "images/face/".$i."/".$cookiearray[$i].".jpg";
把她改回
$pic = "images/face/".$i."/".$cookiearray[$i].".gif";
試試看吧\r

只改這句喔
目前狀態:還是回不去火星.地球還是好危險.

----------------------------------------------------
●我的網站連結:倒了..
----------------------------------------------------
●我所使用的的linux版本:....火星專用版本.!!!???
●我所使用的的Freebsd版本:.5.4
----------------------------------------------------
Newhandme
星球普通子民
星球普通子民
文章: 9
註冊時間: 2004-08-16 00:44

文章 Newhandme »

改後出現以下 error >..<"

代碼: 選擇全部

Warning: imagecreatefromjpeg(): 'images/face/2/22.gif' is not a valid JPEG file in /home1/micecity/public_html/Miso/facealbum.php on line 182

Warning: imagecopyresized(): supplied argument is not a valid Image resource in /home1/micecity/public_html/Miso/facealbum.php on line 183

Warning: imagecreatefromjpeg(): 'images/face/6/007.gif' is not a valid JPEG file in /home1/micecity/public_html/Miso/facealbum.php on line 182

Warning: imagecopyresized(): supplied argument is not a valid Image resource in /home1/micecity/public_html/Miso/facealbum.php on line 183

Warning: imagecreatefromjpeg(): 'images/face/11/init.gif' is not a valid JPEG file in /home1/micecity/public_html/Miso/facealbum.php on line 182

Warning: imagecopyresized(): supplied argument is not a valid Image resource in /home1/micecity/public_html/Miso/facealbum.php on line 183

Warning: imagecreatefromjpeg(): 'images/face/13/init.gif' is not a valid JPEG file in /home1/micecity/public_html/Miso/facealbum.php on line 182

Warning: imagecopyresized(): supplied argument is not a valid Image resource in /home1/micecity/public_html/Miso/facealbum.php on line 183

Warning: imagecreatefromjpeg(): 'images/face/14/init.gif' is not a valid JPEG file in /home1/micecity/public_html/Miso/facealbum.php on line 182

Warning: imagecopyresized(): supplied argument is not a valid Image resource in /home1/micecity/public_html/Miso/facealbum.php on line 183

Warning: imagecreatefromjpeg(): 'images/face/18/init.gif' is not a valid JPEG file in /home1/micecity/public_html/Miso/facealbum.php on line 182

Warning: imagecopyresized(): supplied argument is not a valid Image resource in /home1/micecity/public_html/Miso/facealbum.php on line 183

Warning: imagedestroy(): supplied argument is not a valid Image resource in /home1/micecity/public_html/Miso/facealbum.php on line 191

Warning: Cannot modify header information - headers already sent by (output started at /home1/micecity/public_html/Miso/facealbum.php:182) in /home1/micecity/public_html/Miso/includes/page_header.php on line 495

Warning: Cannot modify header information - headers already sent by (output started at /home1/micecity/public_html/Miso/facealbum.php:182) in /home1/micecity/public_html/Miso/includes/page_header.php on line 497

Warning: Cannot modify header information - headers already sent by (output started at /home1/micecity/public_html/Miso/facealbum.php:182) in /home1/micecity/public_html/Miso/includes/page_header.php on line 498 
會不會是因為我的相片是 Gif 的原因
頭像
心靈捕手
默默耕耘的老師
默默耕耘的老師
文章: 8540
註冊時間: 2004-04-30 01:54
來自: Taiwan

Re: [問題]安裝了虛擬形像 MOd, 但用不了相冊 ><

文章 心靈捕手 »

Newhandme 寫:問題外掛 :虛擬形像 MOd
使用版本 : 2.0.10
作業系統 : Linux
MYSQL 版本 :4.0.12
網站位置 :
狀況描述 :

安裝了虛擬形像 MOd, 但用不了相冊 ><, 當按下保存相片 , 則出現以下error

代碼: 選擇全部

Fatal error: Call to undefined function: imagecreatefromgif() in /home1/micecity/public_html/Miso/facealbum.php on line 182
記得當初我也曾出現過類似的錯誤,
後來倒不是更改'程式碼'而解決問題;
而是因為一開始沒有建立好儲存相片的路徑,
只要加以更正後, 也就解決了.

原本依照安裝說明,
我是在 phpbb2/images/face/ 底下建立一個 pic 資料夾,
出現類似的錯誤後,
將該資料夾更改建立在 phpbb2/ 底下,
(也就是討論區的根目錄底下)
儲存相片也就恢復正常了.

以上經驗, 提供給您參考. ;-)
施比受有福,祝福您好運! ^_^
歡迎光臨★★心靈捕手★★ :: 討論區
https://wang5555.dnsfor.me/phpBB3/
Newhandme
星球普通子民
星球普通子民
文章: 9
註冊時間: 2004-08-16 00:44

文章 Newhandme »

謝謝提供意見, 但我的pic資料夾已是放在根目錄下 >"<
主題已鎖定

回到「外掛問題討論」