i have a networking site that im trying to get gif files to show for members pics.
i got it to show as a gif file but if you upload the a gif file with animation they dont show in the profile. just shows still pic. heres how the image is uploaded to the db.

function photo_upload()	{
	global $_FILES,$base_path,$siteurl;
	$uid=getcookie("uid");
	$pss=getcookie("pss");
	login($uid,$pss);
	$m_phot=1000;
	$tmpfname=$_FILES['photo']['tmp_name'];
	$ftype=$_FILES['photo']['type'];
	$fsize=$_FILES['photo']['size'];
	$capture=getparams('capture');
	$main=getparams('main');
	if($main=='')	$main=0;
	if(!empty($tmpfname))	{
		//checkin image size
		if($fsize>5000*1024)	fireerror(10);
		//checkin image type
		if(($ftype=='image/jpeg')||($ftype=='image/pjpeg'))	$p_type=".jpeg";
		elseif($ftype=='image/gif')	$p_type=".gif";
		else	fireerror(9);
		//$row_chk=photo_album_count($uid,"1","edi");
		//if($row_chk<$m_phot)	{
			$rand=rand(0,10000);
			$newname=md5($uid.time().$rand);
			$newname_th=$newname."th";
			$newname_b_th=$newname."bth";
			$old="photos/".$newname.$p_type;
			$thumb1="photos/".$newname_th.".gif";
			$thumb2="photos/".$newname_b_th.".gif";
			move_uploaded_file($tmpfname,"photos/".$newname.$p_type);
			//creating thumbnails
			if($p_type==".jpeg")	$srcImage = ImageCreateFromJPEG( $old );
			elseif($p_type==".gif")	$srcImage = ImageCreateFromGIF( $old );
			$sizee=getimagesize($old);
			$srcwidth=$sizee[0];
			$srcheight=$sizee[1];
			//landscape
			if($srcwidth>$srcheight)	{
				$destwidth1=65;
				$rat=$destwidth1/$srcwidth;
				$destheight1=(int)($srcheight*$rat);
				$destwidth2=150;
				$rat2=$destwidth2/$srcwidth;
				$destheight2=(int)($srcheight*$rat2);
			}
			//portrait
			elseif($srcwidth<$srcheight)	{
				$destheight1=65;
				$rat=$destheight1/$srcheight;
				$destwidth1=(int)($srcwidth*$rat);
				$destheight2=150;
				$rat=$destheight2/$srcheight;
				$destwidth2=(int)($srcwidth*$rat);
			}
			//quadro
			elseif($srcwidth==$srcheight)	{
				$destwidth1=65;
				$destheight1=65;
				$destwidth2=150;
				$destheight2=150;
			}
			$destImage1 = ImageCreateTrueColor( $destwidth1, $destheight1);
			$destImage2 = ImageCreateTrueColor( $destwidth2, $destheight2);
			ImageCopyResized( $destImage1, $srcImage, 0, 0, 0, 0, $destwidth1, $destheight1, $srcwidth, $srcheight );
			ImageCopyResized( $destImage2, $srcImage, 0, 0, 0, 0, $destwidth2, $destheight2, $srcwidth, $srcheight );
			ImageGif($destImage1, $thumb1, 80);
			ImageGif($destImage2, $thumb2, 80);
			ImageDestroy($srcImage);
			ImageDestroy($destImage1);
			ImageDestroy($destImage2);
			//updating db
			$now=time();
			$photo="photos/".$newname.$p_type;
			$photo_b_thumb="photos/".$newname_b_th.".gif";
			$photo_thumb="photos/".$newname_th.".gif";
			if(empty($capture))	$capture=" ";
			$sql="select * from photo where mem_id='$uid'";
			$num=firesql($sql,'num');
			if ($num==0)	firesql("insert into photo (mem_id) values ('$uid')",'');
			$sql_query="update photo set photo=concat(photo,'|$photo'),photo_b_thumb=concat(photo_b_thumb,'|$photo_b_thumb'),photo_thumb=concat(photo_thumb,'|$photo_thumb'),capture=concat(capture,'|$capture') where mem_id='$uid'";
			firesql($sql_query,'');
			if($main=='1')	{
				$sql_query="update members set photo='$photo',photo_thumb='$photo_thumb',photo_b_thumb='$photo_b_thumb' where mem_id='$uid'";
				firesql($sql_query,'');
			}
		//}	else	$err_mess="You can upload only upto $m_phot photo(s).<br>Your maximum limit reached.";
	}
	//redirect
	$location="index.php?pg=misc&s=edit&type=photos&err_mess=$err_mess";
	go2($location);

im wondering if when it makes it into a thumb that it kind of takes a section of that image and wont show the animated version. But make note in the photo gallery of the members section it shows in this order
1st pic you see is a thumb (same as profile pic)
2nd when you click on it shows the orignial and it works fine this is the capture part of the code.
so how would i show orignal that works as the profile pick.
i know php but im still learning so please bar with me if i ask ?s that are simple to all of you. thanks in advance shwagman

    Write a Reply...