Skip to content
View in the app

A better way to browse. Learn more.

Web Designer Forum

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Picture doesnt always appear

Featured Replies

Hello,

 

I hope this is the right forum as i suspect it is something to do with my php code as to why this problem is happening.

 

Basically i offer advertising for property owners, now when they advertise they upload 8 pictures, the first picture they upload is used as a taster with a small description next to it see this link,

 

http://www.holidayhomesineurope.com/adv_search1.php

 

as you can see there are some with pictures showing and other not, now i am not sure why this would be?

 

Any help here would be greatly appreciated.

Hello,

 

I hope this is the right forum as i suspect it is something to do with my php code as to why this problem is happening.

 

Basically i offer advertising for property owners, now when they advertise they upload 8 pictures, the first picture they upload is used as a taster with a small description next to it see this link,

 

http://www.holidayhomesineurope.com/adv_search1.php

 

as you can see there are some with pictures showing and other not, now i am not sure why this would be?

 

Any help here would be greatly appreciated.

 

Paste ur php code so someone can help :)

  • Author

Paste ur php code so someone can help :)

 

 

Here is the code used

 

application/x-httpd-php photographs.php
PHP script text

<?
include("includes/session.php");

$_SESSION['refer'] = basename($_SERVER['PHP_SELF']);

if(User::isLoggedIn() == true and isset($_REQUEST['property_id']))
{	
$unit_type['1'] = "individual";
$unit_type['2'] = "two unit";
$unit_type['3'] = "three unit";
$unit_type['4'] = "four unit";

$details = User::getDetails();

$user_id = $_SESSION['user_id'];
$property_id = $_REQUEST['property_id'];

$query = mysql_query("select * from property where user_id = '$user_id' and property_id = '$property_id'");
$result_num = mysql_num_rows($query);

if($result_num >=1)
{
	$row = mysql_fetch_array($query);
	$property_type = $row['property_type'];
	$photos_tint = $row['photos_tint'];

	if($photos_tint ==0)
	{
		$photos_tint = 8;
	}
	else
	{
		$photos_tint = $photos_tint + 8;
	}

?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>HolidayHomesInEurope.com :: Photographs</title>
<link href="style.css" rel="stylesheet" type="text/css" />
<style type="text/css">
<!--
.style1 {	font-size: 10px;
font-style: italic;
}
total {
font-size: 15px;
}
.total {
font-size: 18px;
}
.total {
color: #1378BD;
}
.total {
color: #990;
}
.ex {
font-size: 11px;
}
-->
</style>
</head>
<script src="includes/jquery.js" type="text/javascript" language="javascript"></script>
<script src="includes/validation.js" type="text/javascript" language="javascript"></script>
<script src="includes/update.js" type="text/javascript" language="javascript"></script>

<body>
<div class="full">
<div class="container">
	<div id="top">
		<div class="link"><a HREF="www.holidayhomesineurope.com" title="Lorem ipsum dolor sit amet, consectetur adipiscing elit.">www.holidayhomesineurope.com</a> - Lorem ipsum dolor sit amet, consectetur adipiscing elit.</DIV>
<?php
include("includes/login.php");
?>		
	</div>
	<div id="main">
		<div id="menu">
		<ul id="menulist">
			<li><a href="default.php" class="mm00" title="Home" onMouseOver="this.className='mm00o'" onMouseOut="this.className='mm00'"></a></li>
			<li><a href="about.php" class="mm01" title="About Us" onMouseOver="this.className='mm01o'" onMouseOut="this.className='mm01'"></a></li>
			<li><a href="adv_search.php" class="mm02" title="Search" onMouseOver="this.className='mm02o'" onMouseOut="this.className='mm02'"></a></li>
			<li><a href="advertise.php" class="mm03" title="Advertise" onMouseOver="this.className='mm03o'" onMouseOut="this.className='mm03'"></a></li>
			<li><a href="login.php" class="mm04" title="Login" onMouseOver="this.className='mm04o'" onMouseOut="this.className='mm04'"></a></li>
			<li><a href="signup.php" class="mm05" title="Register" onMouseOver="this.className='mm05o'" onMouseOut="this.className='mm05'"></a></li>
			<li><a href="faqs.php" class="mm06" title="FAQs" onMouseOver="this.className='mm06o'" onMouseOut="this.className='mm06'"></a></li>
		</ul>		
		</div>
		<div id="cont_bg">
		<div id="content">
			<div id="content_bottom"><h1>Update photographs</h1>
                <div style="padding-left:8px; padding-right:6px;"> <p class="content">Use this form to upload your photographs.<br />
                      <font size="1">(Maximum 500000 bytes, only .jpg files allowed)  </font></p>
                </div>
                   <table width="100%" border="0" align="center" cellpadding="5" cellspacing="0">
                     <tbody>
                       <tr>
                         <td align="left"><div style="border-style: solid; border-width: 1px;
border-color: #1378bd;width:641px;position:relative;left:20px; ">
                           <div class="property_div">Photographs</div>
                           <table width="100%" border="0" cellpadding="3" cellspacing="2" class="content">
                             <tbody>
                               <tr bgcolor="#FFEBD9">
                                 <td width="24%" valign="top" bgcolor="#FFFFFF"><table width="100%" border="0" cellspacing="2" cellpadding="2">
                                     <tr>
                                       <td width="12%" align="center"><strong>Photograph #</strong></td>
                                       <td width="50%" align="center"><strong>Photograph</strong></td>
                                       <td width="38%" align="center"><strong>Action</strong></td>
                                     </tr>
<?
$query = mysql_query("select * from photograph where property_id = '$property_id' and photograph !=''");
for($ctr=0; $ctr < $photos_tint; $ctr++)
{
$row = mysql_fetch_array($query);
$photograph = $row['photograph'];

?>
									<tr>
                                       <td align="center"><?=$ctr+1;?></td>
                                       <td align="center" class="content2"><? 

									if($photograph =="")
									{
										echo "[No Image]";
									}
									else
									{
										echo "<img src='$photograph'>";
									}
									?></td>
                                       <td align="center"><span class="content2">
                                         <? 

									if($photograph =="")
									{
?>
                                       </span>
                                         <div id="div_<?=$ctr;?>"><form action="upload_photograph.php" method="post" enctype="multipart/form-data" name="form_<?=$ctr;?>" id="form_<?=$ctr;?>"><input name="property_id" type="hidden" value="<?=$property_id;?>" />
                                           <input type="file" name="fileupload" id="fileupload_<?=$ctr;?>" class="input_text" onchange="check_image('fileupload',this.value,'form_<?=$ctr;?>','div_<?=$ctr;?>');" />
                                         </form></div>
                                         <span class="content2">
<?

									}
									else
									{
?>
<a href="delete_photograph.php?property_id=<?=$property_id;?>&photograph_id=<?=$row['photograph_id'];?>">Delete</a><?

										if($row['is_thumb'] !="Y")
										{
?><br />
<br />
<a href="make_thumbnail.php?property_id=<?=$property_id;?>&photograph_id=<?=$row['photograph_id'];?>">Make this thumbnail image</a>
<?
										}
									}
									?>
                                         </span></td>
                                     </tr>
<?
}
?>
                                  <tr>
                                  		<td align="center"><strong>Thumbnail</strong></td>
                                       <td align="center"><span class="content2">
                                         <? 
									$query = mysql_query("select * from photograph where property_id = '$property_id' and photograph !='' and is_thumb ='Y'");											
									$result_num = mysql_num_rows($query);
									if($result_num =="" or $result_num ==0)

									{
										echo "[No Thumbnail]";
									}
									else
									{
										$row = mysql_fetch_array($query);
										$photograph = $row['photograph'];
										echo "<img src='$photograph'>";
									}
									?>
                                       </span></td>
                                       <td align="center"><span class="content2">
                                         <? 

									if($result_num !="" or $result_num !=0)
									{
?><a href="remove_thumbnail.php?property_id=<?=$property_id;?>">Remove thumbnail</a>
<?
									}
									?>
                                       </span></td>
                                  </tr> </table></td>
                                 </tr>
                             </tbody>
                           </table>
                         </div></td>
                       </tr>
                     </tbody>
                   </table>
</div>
		</div>
		</div>
	</div>
	<div id="column">
		<?php include('column.php'); ?>
	</div>
	<div id="footer">
		<div class="copy">
			<strong>© holidayhomesineurope.com 2010</strong><br />All rights reserved.
		</div>
	    <div class="pipelist">
	    	<ul>
				<li><a href="default.php" title="Home">Home</a></li>
				<li><a href="about.php" title="About Us">About Us</a></li>
				<li><a href="adv_search.php" title="Search">Search</a></li>
				<li><a href="advertise.php" title="Advertise">Advertise</a></li>
				<li><a href="login.php" title="Login">Login</a></li>
				<li><a href="terms.php" title="Terms">Terms</a></li>							
				<li class="last"><a href="faqs.php" title="FAQs">FAQs</a></li>
  				</ul>
	    </div>		
	</div>		
</div>
</div>
</body>
</html>
<?
}
else
{
	header("Location: dashboard.php");
}
}
else
{
	header("Location:".XPROOT."login.php");
}
?>



Where are, in the code the pictures you are talking about ?!? Is too difficult in this way, help us and post just the interested part of the code

Here is the code used

 

application/x-httpd-php photographs.php
PHP script text

<?
include("includes/session.php");

$_SESSION['refer'] = basename($_SERVER['PHP_SELF']);

if(User::isLoggedIn() == true and isset($_REQUEST['property_id']))
{	
$unit_type['1'] = "individual";
$unit_type['2'] = "two unit";
$unit_type['3'] = "three unit";
$unit_type['4'] = "four unit";

$details = User::getDetails();

$user_id = $_SESSION['user_id'];
$property_id = $_REQUEST['property_id'];

$query = mysql_query("select * from property where user_id = '$user_id' and property_id = '$property_id'");
$result_num = mysql_num_rows($query);

if($result_num >=1)
{
	$row = mysql_fetch_array($query);
	$property_type = $row['property_type'];
	$photos_tint = $row['photos_tint'];

	if($photos_tint ==0)
	{
		$photos_tint = 8;
	}
	else
	{
		$photos_tint = $photos_tint + 8;
	}

?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>HolidayHomesInEurope.com :: Photographs</title>
<link href="style.css" rel="stylesheet" type="text/css" />
<style type="text/css">
<!--
.style1 {	font-size: 10px;
font-style: italic;
}
total {
font-size: 15px;
}
.total {
font-size: 18px;
}
.total {
color: #1378BD;
}
.total {
color: #990;
}
.ex {
font-size: 11px;
}
-->
</style>
</head>
<script src="includes/jquery.js" type="text/javascript" language="javascript"></script>
<script src="includes/validation.js" type="text/javascript" language="javascript"></script>
<script src="includes/update.js" type="text/javascript" language="javascript"></script>

<body>
<div class="full">
<div class="container">
	<div id="top">
		<div class="link"><a HREF="www.holidayhomesineurope.com" title="Lorem ipsum dolor sit amet, consectetur adipiscing elit.">www.holidayhomesineurope.com</a> - Lorem ipsum dolor sit amet, consectetur adipiscing elit.</DIV>
<?php
include("includes/login.php");
?>		
	</div>
	<div id="main">
		<div id="menu">
		<ul id="menulist">
			<li><a href="default.php" class="mm00" title="Home" onMouseOver="this.className='mm00o'" onMouseOut="this.className='mm00'"></a></li>
			<li><a href="about.php" class="mm01" title="About Us" onMouseOver="this.className='mm01o'" onMouseOut="this.className='mm01'"></a></li>
			<li><a href="adv_search.php" class="mm02" title="Search" onMouseOver="this.className='mm02o'" onMouseOut="this.className='mm02'"></a></li>
			<li><a href="advertise.php" class="mm03" title="Advertise" onMouseOver="this.className='mm03o'" onMouseOut="this.className='mm03'"></a></li>
			<li><a href="login.php" class="mm04" title="Login" onMouseOver="this.className='mm04o'" onMouseOut="this.className='mm04'"></a></li>
			<li><a href="signup.php" class="mm05" title="Register" onMouseOver="this.className='mm05o'" onMouseOut="this.className='mm05'"></a></li>
			<li><a href="faqs.php" class="mm06" title="FAQs" onMouseOver="this.className='mm06o'" onMouseOut="this.className='mm06'"></a></li>
		</ul>		
		</div>
		<div id="cont_bg">
		<div id="content">
			<div id="content_bottom"><h1>Update photographs</h1>
                <div style="padding-left:8px; padding-right:6px;"> <p class="content">Use this form to upload your photographs.<br />
                      <font size="1">(Maximum 500000 bytes, only .jpg files allowed)  </font></p>
                </div>
                   <table width="100%" border="0" align="center" cellpadding="5" cellspacing="0">
                     <tbody>
                       <tr>
                         <td align="left"><div style="border-style: solid; border-width: 1px;
border-color: #1378bd;width:641px;position:relative;left:20px; ">
                           <div class="property_div">Photographs</div>
                           <table width="100%" border="0" cellpadding="3" cellspacing="2" class="content">
                             <tbody>
                               <tr bgcolor="#FFEBD9">
                                 <td width="24%" valign="top" bgcolor="#FFFFFF"><table width="100%" border="0" cellspacing="2" cellpadding="2">
                                     <tr>
                                       <td width="12%" align="center"><strong>Photograph #</strong></td>
                                       <td width="50%" align="center"><strong>Photograph</strong></td>
                                       <td width="38%" align="center"><strong>Action</strong></td>
                                     </tr>
<?
$query = mysql_query("select * from photograph where property_id = '$property_id' and photograph !=''");
for($ctr=0; $ctr < $photos_tint; $ctr++)
{
$row = mysql_fetch_array($query);
$photograph = $row['photograph'];

?>
									<tr>
                                       <td align="center"><?=$ctr+1;?></td>
                                       <td align="center" class="content2"><? 

									if($photograph =="")
									{
										echo "[No Image]";
									}
									else
									{
										echo "<img src='$photograph'>";
									}
									?></td>
                                       <td align="center"><span class="content2">
                                         <? 

									if($photograph =="")
									{
?>
                                       </span>
                                         <div id="div_<?=$ctr;?>"><form action="upload_photograph.php" method="post" enctype="multipart/form-data" name="form_<?=$ctr;?>" id="form_<?=$ctr;?>"><input name="property_id" type="hidden" value="<?=$property_id;?>" />
                                           <input type="file" name="fileupload" id="fileupload_<?=$ctr;?>" class="input_text" onchange="check_image('fileupload',this.value,'form_<?=$ctr;?>','div_<?=$ctr;?>');" />
                                         </form></div>
                                         <span class="content2">
<?

									}
									else
									{
?>
<a href="delete_photograph.php?property_id=<?=$property_id;?>&photograph_id=<?=$row['photograph_id'];?>">Delete</a><?

										if($row['is_thumb'] !="Y")
										{
?><br />
<br />
<a href="make_thumbnail.php?property_id=<?=$property_id;?>&photograph_id=<?=$row['photograph_id'];?>">Make this thumbnail image</a>
<?
										}
									}
									?>
                                         </span></td>
                                     </tr>
<?
}
?>
                                  <tr>
                                  		<td align="center"><strong>Thumbnail</strong></td>
                                       <td align="center"><span class="content2">
                                         <? 
									$query = mysql_query("select * from photograph where property_id = '$property_id' and photograph !='' and is_thumb ='Y'");											
									$result_num = mysql_num_rows($query);
									if($result_num =="" or $result_num ==0)

									{
										echo "[No Thumbnail]";
									}
									else
									{
										$row = mysql_fetch_array($query);
										$photograph = $row['photograph'];
										echo "<img src='$photograph'>";
									}
									?>
                                       </span></td>
                                       <td align="center"><span class="content2">
                                         <? 

									if($result_num !="" or $result_num !=0)
									{
?><a href="remove_thumbnail.php?property_id=<?=$property_id;?>">Remove thumbnail</a>
<?
									}
									?>
                                       </span></td>
                                  </tr> </table></td>
                                 </tr>
                             </tbody>
                           </table>
                         </div></td>
                       </tr>
                     </tbody>
                   </table>
</div>
		</div>
		</div>
	</div>
	<div id="column">
		<?php include('column.php'); ?>
	</div>
	<div id="footer">
		<div class="copy">
			<strong>© holidayhomesineurope.com 2010</strong><br />All rights reserved.
		</div>
	    <div class="pipelist">
	    	<ul>
				<li><a href="default.php" title="Home">Home</a></li>
				<li><a href="about.php" title="About Us">About Us</a></li>
				<li><a href="adv_search.php" title="Search">Search</a></li>
				<li><a href="advertise.php" title="Advertise">Advertise</a></li>
				<li><a href="login.php" title="Login">Login</a></li>
				<li><a href="terms.php" title="Terms">Terms</a></li>							
				<li class="last"><a href="faqs.php" title="FAQs">FAQs</a></li>
  				</ul>
	    </div>		
	</div>		
</div>
</div>
</body>
</html>
<?
}
else
{
	header("Location: dashboard.php");
}
}
else
{
	header("Location:".XPROOT."login.php");
}
?>



 

Let me ask u are u looping through each photo using a while loop if not that might be why all the photos are not showing

  • Author

here is the code to upload images

 


application/x-httpd-php upload_photograph.php
PHP script text

<?
include("includes/session.php");

$_SESSION['refer'] = basename($_SERVER['PHP_SELF']);

if(User::isLoggedIn() == true and isset($_REQUEST['property_id']))
{	
$details = User::getDetails();
$user_id = $_SESSION['user_id'];
$property_id = $_REQUEST['property_id'];
$query = mysql_query("select * from property where user_id = '$user_id' and property_id = '$property_id'");
$result_num = mysql_num_rows($query);
if($result_num >=1)
{
	$row = mysql_fetch_array($query);
	$photos_tint = $row['photos_tint'];

	if($photos_tint ==0)
	{
		$photos_tint = 8;
	}
	else
	{
		$photos_tint = $photos_tint + 8;
	}
	$query = mysql_query("select count(*) as total from photograph where property_id = '$property_id'");
	$row = mysql_fetch_array($query);
	$total = $row['total'];
	if($photos_tint > $total)
	{
		//pic upload
		$fileupload = $_FILES['fileupload'];
		if($fileupload['name'] !="")
		{
			if($fileupload['size'] <= 5000000000)
			{
				// picupload script starts
				//Get the file information
				$userfile_name = $_FILES['fileupload']['name'];
				$userfile_tmp = $_FILES['fileupload']['tmp_name'];
				$userfile_size = $_FILES['fileupload']['size'];
				$filename = basename($_FILES['fileupload']['name']);
				$file_ext = substr($filename, strrpos($filename, '.') + 1);
				//Only process if the file is a JPG and below the allowed limit
				if((!empty($_FILES["fileupload"])) && ($_FILES['fileupload']['error'] == 0)) {
					if (($file_ext!="jpg") && ($userfile_size > $max_file)) {
						$error= "ONLY jpeg images under 1MB are accepted for upload";
					}
				}else{
					$error= "Select a jpeg image for upload";
				}
				//Everything is ok, so we can upload the image.
				if (strlen($error)==0){

					if (isset($_FILES['fileupload']['name'])){

						move_uploaded_file($userfile_tmp, $large_image_location);
						chmod($large_image_location, 0777);

						$width = getWidth($large_image_location);
						$height = getHeight($large_image_location);
						//Scale the image if it is greater than the width set above
						if ($width > $max_width){
							$scale = $max_width/$width;
							$uploaded = resizeImage($large_image_location,$width,$height,$scale);
						}else{
							$scale = 1;
							$uploaded = resizeImage($large_image_location,$width,$height,$scale);
						}

						//saving the image in the db

						mysql_query("insert into photograph(photograph, property_id) values('$uploaded','$property_id')");
						//Delete the thumbnail file so the user can create a new one
						if (file_exists($thumb_image_location)) {
							unlink($thumb_image_location);
						}

									echo "<script>alert('Your picture has been uploaded successfully!');
							window.location ='photographs.php?property_id=$property_id';
							</script>";

					}
				}
			// picupload script ends
			}
			else
			{
				echo "<script> alert('Image couldnt be uploaded. The image size exceeded 500000 bytes.'); window.location ='photographs.php?property_id=$property_id';</script>";
			}
		}
	}
	else
	{
		echo "<script>alert('Sorry, you cant upload more pictures.');

		window.location ='photographs.php?property_id=$property_id';
		</script>";
	}

}
else
{
	header("Location: dashboard.php");
}
}
else
{
	header("Location:".XPROOT."login.php");
}
?>


Create an account or sign in to comment

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.