我有一个捕获图像的闪存代码。这是代码:
<object id="main" width="300" height="400" align="middle" type="application/x-shockwave-flash" name="main" data="<?php echo JS_PATH;?>bin-debug/dev.swf">
<param name="quality" value="high">
<param name="bgcolor" value="#ffffff">
<param name="allowscriptaccess" value="sameDomain">
<param name="allowfullscreen" value="true">
<param name="flashvars" value="<?php echo HTTP_PATH.DS?>user/changeprofilepic_byweb">
</object>
在上面的代码中:
<param name="flashvars" value="<?php echo HTTP_PATH.DS?>user/changeprofilepic_byweb">
value 参数包含控制器的路径,其中函数 changeprofielpic_byweb 包含更新 profiel 图像的代码。我无法更新图像。我哪里错了?我的闪存代码是正确的吗?我的闪存代码工作正常,它可以捕获图像,但它没有存储到数据库中。这是控制器的代码:
function changeprofilepic_byweb()
{
echo "<script> alert('In to the function'); </script>";
$sess_data = $this->session->userdata('logged_in');
$this->load->library('photoslibrary');
$this->load->Model('usersocialprofile');
$upload_path = COMM_USER_IMAGE_PATH.$sess_data['user_id'];
if(!is_dir($upload_path))
{
umask(0);
@mkdir($upload_path,077);
}
$db_userprofile = $this->usersocialprofile->getThumb($sess_data['user_id']);
if(is_file(COMM_USER_IMAGE_PATH.$sess_data['user_id'].DS.$db_userprofile[0]->imageTitle))
{
$this->usersocialprofile->unlinkImage($db_userprofile[0],PROFILE_IMAGE_THUMB);
}
$this->load->helper("Image");
$fileImage="";
$data['error']="";
$fileext='jpeg';
$timestamp=md5(time());
$filename="photo".$timestamp.".".$fileext;
$filesize = floatval((filesize($filename)/1024)/1024); // bytes to MB
list($width, $height, $type, $attr) = getimagesize($filename);
$req_size=explode(",",PROFILE_IMAGE_THUMB);
$req_size=explode("x",$req_size[0]);
if($width<$req_size[0] || $height<$req_size[1])
{
$data['error']="Image required minimum ".$req_size[0]."x".$req_size[1]." pixels";
}else {
$data['error']="";
$newthumb_path = "thumb".DS;
if(!is_dir($newthumb_path)) {
umask(0);
@mkdir($newthumb_path,0777);
}
$fileImage=imageresize($filename,$filetempname,PROFILE_IMAGE_THUMB,$upload_path.DS,false,true,true,$newthumb_path);
$result=$this->usersocialprofile->updateImage($sess_data['user_id'] , $fileImage);
}
}
我认为该函数不是由闪存代码调用的。我没有收到任何错误。只是显示捕获的图像,但没有在文件夹中更新。