?
Solved

Why dosent it display picture ?

Posted on 2011-10-25
10
Medium Priority
?
188 Views
Last Modified: 2012-05-12
Hi!

Include source for displaying picture.
But it dosent display any picture ?

What is wrong with this line:
<img src="getsnap.php?id={$user.id}&amp;typ=pic&amp;width={$config.disp_snap_width}&amp;height={$config.disp_snap_height}" width=100 height=118 class="smallpic" style="margin:10px 20px 10px 0px;" alt="" />


{strip}
<div class="module_detail">
    <br />  
	<div style="text-align:center;margin-top:2px;">
		{if ($smarty.session.UserId != '' && $smarty.session.security.seepictureprofile == 1) or $smarty.session.UserId == ''}
			{if $config.enable_mod_rewrite == 'Y'}
				<a href="javascript:popUpScrollWindow2('{$docroot}{if $smarty.session.AdminId > 0}{$smarty.const.ADMIN_DIR}{/if}{if $config.seo_username == 'Y'}{$item.username}{else}{$item.id}.htm{/if}','center',650,600)" class="textcolor">
			{else}
				<a href="javascript:popUpScrollWindow2('{$docroot}{if $smarty.session.AdminId > 0}{$smarty.const.ADMIN_DIR}{/if}showprofile.php?id={$item.id}','center',650,600)" class="textcolor">
			{/if}
			<img src="getsnap.php?id={$user.id}&amp;typ=pic&amp;width={$config.disp_snap_width}&amp;height={$config.disp_snap_height}" width=100 height=118 class="smallpic" style="margin:10px 20px 10px 0px;" alt="" />
			</a>
		{/if}
	</div>
	<div style="text-align:center;margin-top:2px; " class="smallest_profiles">
		<strong>{$item.username}</strong><br />
		{$item.age} , {$item.city} {mylang mkey='signup_gender_values' skey=$item.city}
		
	</div>
	<div class="line_top_bottom_pad"  align="center">
		{checkuser userid=$item.id checkfor='online'}
	</div>
</div>
{/strip}

Open in new window

0
Comment
Question by:team2005
  • 7
  • 3
10 Comments
 
LVL 2

Author Comment

by:team2005
ID: 37023214
Hi!

Include the getsnap.php to:


<?php
/***********************************************
osDate Open-Source Dating and Matchmaking Script

(c) 2009 TUFaT.com

osDate was created by Darren Gates and Vijay Nair,
and can be downloaded freely from www.TUFaT.com.
It is distributed under the LGPL license.

osDate is free for commercial and non-commercial
uses. You may modify, re-sell, and re-distribute
osDate. Links back to TUFaT.com are appreciated.

This program is distributed in the hope that it
will be useful, but without any warranty, and
without even the implied warranty of merchantability
or fitness for a particular purpose. While strong
efforts have been taken to ensure the reliability,
security, and stability of osDate, all software
carries risk. Your use of osDate means that you
understand and accept the risks of using osDate.

For osDate documentation, change log, community
forum, latest updates, and project details,
please go to www.TUFaT.com  The osDate project is
supported through the sale of skins and add-ons,
which are entirely optional but help with the
development and design effort.
***********************************************/

ob_start();

if ( !defined( 'SMARTY_DIR' ) ) {
	include_once( 'minimum_init.php' );
}

include(OSDATE_INC_DIR.'internal/snaps_functions.php');

if (isset($_REQUEST['username']) && $_REQUEST['username'] != '') {
	$userid = $osDB->getOne('select id from ! where username = ?',array(USER_TABLE, $_REQUEST['username']) );
} else {
	//  include ( 'sessioninc.php' );

	if( !isset($_GET['id']) || (isset($_GET['id'])&& (int)$_GET['id'] <= 0 ) ) {

		$userid = $_SESSION['UserId'];

	} else {

		$userid = $_GET['id'];

	}
}


if (!isset($_GET['picid']) ) {

	if ((isset($_REQUEST['type']) && $_REQUEST['type'] != 'gallery') || !isset($_REQUEST['type']) ) {

		$defpic = $osDB->getOne('select picno from ! where userid = ? and ( album_id is null or album_id = ?) and default_pic = ? and active = ? ',array(USER_SNAP_TABLE, $userid,'0','Y','Y' ) );

		if ($defpic != '') {
			$picid = $defpic;
		} else {

			$picid = $osDB->getOne('select picno from ! where userid = ? and ( album_id is null or album_id = ?) and active=? order by rand()',array(USER_SNAP_TABLE, $userid,'0','Y' ) );

		}
		unset( $defpic);
	}
} else {

	$picid = $_GET['picid'];

}

$typ = isset( $_GET['typ'])?$_GET['typ']:'pic' ;

$cond = '';

if ( ($config['snaps_require_approval'] == 'Y' || $config['snaps_require_approval'] == '1') && $userid != $_SESSION['UserId'] ) {

	$cond = " and active = 'Y' ";
}

$sql = 'select *  from ! where userid = ? and picno = ? '.$cond;

/* Get the watermarked picture file from cache directory.  */
$row =& $osDB->getRow ( $sql, array( USER_SNAP_TABLE, $userid, $picid ) );

$img = getPicture($userid, $picid, $typ, $row);

$ext = ($typ = 'tn')?$row['tnext']:$row['picext'];

if ( $img != '' && ( ( hasRight('seepictureprofile') && ( $config['snaps_require_approval'] == 'Y' && $row['active'] == 'Y'  ) ||$config['snaps_require_approval'] == 'N' ) || $userid == $_SESSION['UserId']  ) ) {

	$img2 = $img;

} else {

	$gender = $osDB->getOne( 'select gender from ! where id = ?', array( USER_TABLE, $userid ) ) ;

	if ($gender == 'M') {
		$nopic = SKIN_IMAGES_DIR.'male.jpg';
	} elseif ($gender == 'F') {
		$nopic = SKIN_IMAGES_DIR.'female.jpg';
	} elseif ($gender == 'C') {
		$nopic = SKIN_IMAGES_DIR.'couple.jpg';
	}

	$img2 = imagecreatefromjpeg($nopic);
	$ext = 'jpg';
}

ob_end_clean();
header("Pragma: public");
header("Content-Type: image/".$ext);
header("Content-Transfer-Encoding: binary");
header("Cache-Control: must-revalidate");

$ExpStr = "Expires: " . gmdate("D, d M Y H:i:s", time() - 30) . " GMT";

header($ExpStr);
header("Content-Disposition: attachment; filename=profile_".$userid."_".$typ.".".$ext);

/*
 if ($_SESSION['browser'] != 'MSIE') {

	header("Content-Disposition: inline" );
 }
*/
if ($ext == 'jpg') {
	imagejpeg($img2);
} elseif ($ext == 'gif') {
	imagegif($img2);
} elseif ($ext == 'png') {
	imagepng($img2);
} elseif ($ext == 'bmp') {
	imagewbmp($img2);
}
imagedestroy($img2);
?>

Open in new window

0
 
LVL 15

Expert Comment

by:Eyal
ID: 37023235
try this...

<img src="getsnap.php?id={$user.id}&typ=pic&width={$config.disp_snap_width}&height={$config.disp_snap_height}" width=100 height=118 class="smallpic" style="margin:10px 20px 10px 0px;" alt="" />
                  
0
 
LVL 2

Author Comment

by:team2005
ID: 37023256
Hi!

Dosent help, sorry :(
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
LVL 15

Expert Comment

by:Eyal
ID: 37023287
take the generated image link and try to open it in a browser. does it show the image?
0
 
LVL 2

Author Comment

by:team2005
ID: 37023300
Hi!

Yes it shows the profilepage with the picture. When i click on the Image link
0
 
LVL 2

Author Comment

by:team2005
ID: 37023316
Hi!

When i clik right mouse button, and select show picture. It say that the picture is emty ???
0
 
LVL 15

Accepted Solution

by:
Eyal earned 2000 total points
ID: 37023322
view the source and see what is the value of the src of the image
0
 
LVL 2

Author Comment

by:team2005
ID: 37023324
Hi!

Tryed to call this in the browser

getsnap.php?id=951  -> shows the picture
0
 
LVL 2

Author Comment

by:team2005
ID: 37023358
Hi!

The problem was that $user.id was emty
Inserted $item.id insted, now the pictures are shown :)

Thanks so mutsh Eval :)

0
 
LVL 2

Author Closing Comment

by:team2005
ID: 37023362
Thanks
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Finding original email is quite difficult due to their duplicates. From this article, you will come to know why multiple duplicates of same emails appear and how to delete duplicate emails from Outlook securely and instantly while vital emails remai…
Many old projects have bad code, but the budget doesn't exist to rewrite the codebase. You can update this code to be safer by introducing contemporary input validation, sanitation, and safer database queries.
In this tutorial viewers will learn how to embed an audio file in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: : The declaration should display (CODE) HTML5 is supported by the most recent versions of all major browsers…
In this tutorial viewers will learn how to embed videos in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: "<!DOCTYPE html>": Use the <video> tag to insert a video. Define the src as the URL of your video; this is similar to …
Suggested Courses

571 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question