473,396 Members | 1,997 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Displaying Images

12
I have a website that allows users to regsiter, login and then create/update their user profiles. Users are allowed to also upload a profile picture, but the next time a user logs in the profile picture sometimes has some associated display problems i.e. it could happen that the picture does not display properly, is missing or has some other problem. This problem seems to be random in nature. Is there any way of making the display of this picture better? My website is using HTML/PHP/MySQL for its development.
Jun 2 '12 #1
6 2178
Dormilich
8,658 Expert Mod 8TB
how do you save the pictures exactly?
Jun 4 '12 #2
Wilgar
12
See below table containing image coding...any ideas?

Expand|Select|Wrap|Line Numbers
  1. <table width="100%" border="0" cellspacing="0" cellpadding="4">
  2.                         <tr>
  3.                           <td width="15%" valign="top"><b>User Type</b>&nbsp;<span title="This field is required" class="form-required">*</span></td>
  4.                           <td width="85%" valign="top"><table width="50%" border="0" cellspacing="0" cellpadding="3">
  5.                             <tr>
  6.                               <td width="18%"><b><label for="_UserType_P">Private User</label></b></td>
  7.                               <td width="9%"><input id="_UserType_P" type="radio" name="_UserType" value="P" <?php echo (($_UserType=='P') ? ' checked="checked"' : ''); ?> onclick="javascript:fnToggleBus(0);" /></td>
  8.                               <td width="22%"><b><label for="_UserType_B">Business User</label></b></td>
  9.                               <td width="51%"><input id="_UserType_B" type="radio" name="_UserType" value="B" <?php echo (($_UserType=='B') ? ' checked="checked"' : ''); ?> onclick="javascript:fnToggleBus(1);" /></td>
  10.                             </tr>
  11.                           </table></td>
  12.                         </tr>
  13.                         <tr>
  14.                           <td valign="top"><strong>Profile Picture </strong></td>
  15.                           <td valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="0">
  16.                               <tr>
  17.                                 <td width="9%"><iframe id="frmImage" frameborder="0" src="/proc/images.php" <?php echo (($_SESSION['User']['Picture']!='' || count($_SERVER['Images'])>0) ? ' height="200"' : ' height="50"'); ?>></iframe></td>
  18.                                 <td width="91%"></td>
  19.                               </tr>
  20.                             </table></td>
  21.                         </tr>
  22.                         <tr>
  23.                           <td valign="top"><strong>Username</strong></td>
  24.                           <td valign="top"><input class="form-text" id="_Email2" type="text" name="_Email2" value="<?php echo $_Username; ?>" maxlength="255" /></td>
  25.                         </tr>
  26.                         <tr>
  27.                             <td valign="top"><b>Login Email</b>&nbsp;<span title="This field is required" class="form-required">*</span></td>
  28.                             <td valign="top"><input class="form-text" id="_Email" type="text" name="_Email" value="<?php echo $_Email; ?>" maxlength="255" /></td>
  29.                         </tr>
  30.                         <tr>
  31.                           <td valign="top"><b>Password</b></td>
  32.                           <td valign="top"><input class="form-text" id="_Password" type="password" name="_Password" maxlength="100" value="0123456789" /></td>
  33.                         </tr>
  34.                         <tr>
  35.                           <td valign="top"><b>Name</b>&nbsp;<span title="This field is required" class="form-required">*</span></td>
  36.                           <td valign="top"><input class="form-text" id="_Name" type="text" name="_Name" value="<?php echo $_Name; ?>" maxlength="100" /></td>
  37.                         </tr>
  38.                         <tr>
  39.                           <td valign="top"><b>Surname</b>&nbsp;<span title="This field is required" class="form-required">*</span></td>
  40.                           <td valign="top"><input class="form-text" id="_Surname" type="text" name="_Surname" value="<?php echo $_Surname; ?>" maxlength="100" /></td>
  41.                         </tr>
  42.                         <tr>
  43.                           <td valign="top"><b>Date of birth</b>&nbsp;<span title="This field is required" class="form-required">*</span></td>
  44.                           <td valign="top"><select name="_DOB_d" id="_DOB_d" style="width:auto;">
  45.                             <option value="" selected="selected">Day</option>
  46.                             <?php
  47.                             for ($d=1; $d<=31; $d++){
  48.                                 echo '<option value="' . $d . '"';
  49.                                 if($_DOB_d == $d){
  50.                                     echo ' selected="selected"';
  51.                                 }
  52.                                 echo '>' . $d . '</option>';
  53.                             }
  54.                             ?>
  55.                         </select>&nbsp;<select name="_DOB_m" id="_DOB_m" style="width:auto;">
  56.                             <option value="" selected="selected">Month</option>
  57.                             <?php
  58.                             foreach(Array(1 => 'January', 'Febuary', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December') as $m => $mM){
  59.                                 echo '<option value="' . $m . '"';
  60.                                 if($_DOB_m == $m){
  61.                                     echo ' selected="selected"';
  62.                                 }
  63.                                 echo '>' . $mM . '</option>';
  64.                             }
  65.                             ?>
  66.                         </select>&nbsp;<select name="_DOB_y" id="_DOB_y" style="width:auto;">
  67.                             <option value="" selected="selected">Year</option>
  68.                             <?php
  69.                             for($y=2011; $y>=1900; $y--){
  70.                                 echo '<option value="' . $y . '"';
  71.                                 if($_DOB_y == $y){
  72.                                     echo ' selected="selected"';
  73.                                 }
  74.                                 echo '>' . $y . '</option>';
  75.                             }
  76.                             ?>
  77.                         </select>                        </td></tr>
  78.                         <tr>
  79.                             <td valign="top"><b>Gender</b>&nbsp;<span title="This field is required" class="form-required">*</span></td><td valign="top"><label>Male&nbsp;<input id="_Gender" type="radio" name="_Gender" value="M" <?php echo (($_Gender=='M') ? ' checked="checked"' : ''); ?> /></label>&nbsp;&nbsp;<label>Female<input id="_Gender" type="radio" name="_Gender" value="F" <?php echo (($_Gender=='F') ? ' checked="checked"' : ''); ?> /></label></td>
  80.                         </tr>
  81.                         <tr>
  82.                             <td valign="top"><b>Interests</b></td><td valign="top">
  83.                             <select name="_Interest" id="_Interest">
  84.                                 <option value="" selected="selected">Select Interest</option>
  85.                                 <?php
  86.                                 $rsInterest = $oConn->query("SELECT ID,Description FROM TblInterest ORDER BY Description");
  87.                                 foreach($rsInterest as $aInterest){
  88.                                     echo '<option value="' . $aInterest[0] . '"' . (($_Interest == $aInterest[0]) ? ' selected="selected"' : '') . '>' . $aInterest[1] . '</option>';
  89.                                 }
  90.                                 ?>
  91.                             </select>            
  92.                             </td>
  93.                         </tr>
  94.     </table>
Jun 4 '12 #3
Dormilich
8,658 Expert Mod 8TB
I may be blind, but I’m not seeing any code that saves the image.
Jun 4 '12 #4
Wilgar
12
Please see the piece of code extracted from the above:
Expand|Select|Wrap|Line Numbers
  1. <td width="9%"><iframe id="frmImage" frameborder="0" src="/proc/images.php" <?php echo (($_SESSION['User']['Picture']!='' || count($_SERVER['Images'])>0) ? ' height="200"' : ' height="50"'); ?>></iframe></td> 
  2.  
Also please see attached print-screen pic, which shows an example display error. Where the red rectangle is there should be a profile picture displayed, but it is missing...

What do you think the best way of saving and displaying a profile pic should be?

This is all the information I have at the moment, the rest will be with the developer...
Attached Images
File Type: jpg Profile Pic Error.jpg (28.2 KB, 158 views)
Jun 5 '12 #5
Dormilich
8,658 Expert Mod 8TB
why in the world would you display an image by an <iframe>? that’s what the <img> tag is for. and for upload I’d just use a file upload field ...

and unless I know what images.php does, how am I supposed to know whether it is wrong or right what you see?
Jun 5 '12 #6
Wilgar
12
Apologies for the delay. Please check out the info below contained in the file "images.php" and let me know if you can maybe pic up a problem with regards to the profile image framing?

Expand|Select|Wrap|Line Numbers
  1. <?php
  2.  
  3. @session_start();
  4. /*echo '<pre>';
  5. print_r($_SESSION);
  6. echo '</pre>';*/
  7.  
  8. $sError ='';
  9. if(isset($_SESSION['uploadError'])){
  10.     $sError .= $_SESSION['uploadError'];
  11. }
  12. if(isset($_SESSION['Images'])){$Images = $_SESSION['Images'];}
  13. else{$Images = Array();}
  14.  
  15. echo "
  16. <html>
  17.     <head>
  18.         <style>*{padding:0; margin:0; font:Normal 13px Tahoma;} table.gallery{padding-right:10px;}table.gallery td{vertical-align:bottom;}table.gallery td{padding:5px;}table.gallery td div{padding-bottom:3px; text-align:center;}</style>
  19.     </head>
  20. <body style='background-color:#f0f0f0;'><form method='post' enctype='multipart/form-data'>\n";
  21.  
  22. $iImgCount = count($Images);
  23. if($iImgCount<1){
  24.     echo"<input name='flImage' type='file' onchange='javascript:fnAddImage()' /><br />";
  25.     echo"<script language='javascript'>function fnAddImage(){var f=document.forms[0];if(f.flImage.value.length!=0){f.action='default.php';f.submit();}}</script>\n";
  26. }
  27.  
  28. if($iImgCount>0){
  29.     if(count($Images)>0){
  30.         $sImage = 'Photos/' . $Images[0] . "_t.jpg";
  31.         $_SERVER['User']['Picture'] = $Images[0];
  32.         echo "<br /><table border='0' class='gallery'><tr><td><img src='/$sImage' width='150' /></td></tr><tr><td align='center'><a href='images_rem.php?id=0' title='Remove'>Remove</a></td></tr></table>\n";
  33.     }
  34.     else{
  35.         echo "<table class='gallery' cellspacing='10'><tr>";
  36.         $iCount = 0;
  37.         foreach($Images as $i => $Image){
  38.             $sImage = 'Photos/' . $Image . "_t.jpg";
  39.             $iCount++;
  40.             echo "<td><div class='item'><img src='/$sImage' width='150' /></div><div><a href='images_rem.php?id=$i'>Remove</a></div></td>\n";
  41.             if($iCount>=2){
  42.                 echo '</tr><tr>';
  43.                 $iCount=0;
  44.             }
  45.         }
  46.         echo "</table>";
  47.     }
  48. }
  49.  
  50. echo "</form>";
  51. echo ($sError !='') ? "<div style='color:red;'>$sError</div>\n" : '';
  52. echo "<script language='javascript'>window.onload=function(){window.parent.document.getElementById('frmImage').height=(window.document.body.scrollHeight+20);}</script></body</html>";
  53.  
  54. if(isset($_SESSION['uploadError'])){
  55.     unset($_SESSION['uploadError']);
  56. }
Sep 19 '12 #7

Sign in to post your reply or Sign up for a free account.

Similar topics

5
by: Jelks Cabaniss | last post by:
I asked this in two of the Opera newsgroups, but except for one person who advised me to just use namespaced HTML elements in my XML, there were no replies. Has anybody here successfully used...
11
by: Ian Davies | last post by:
Hello Im having problems displaying my images as thumbnails in a table. My code for producing the new width and height from the original image is as follows...
3
by: Dalan | last post by:
At first I was not certain what could cause Access 97 from displaying most jpeg images, but not all. After further testing, it seemed that all original images of less than 275 pixels per inch or...
0
by: Matt | last post by:
Hi I'm have difficulty displaying images that are stored in a MySQL database. I've tried using the odbc.net provider, the ByteFX provider and the MySQLDriverCS one but can't seem to get the...
4
by: group8perl | last post by:
I have a Perl script which also has some HTML. I managed to get the images to display on explorer using Apache but when using Linux and Firefox the images are not displayed. When using right click...
10
by: gnewsgroup | last post by:
I've googled and tried various approaches, but could not resolve this problem. The article at MSDN: Displaying Images in a GridView Column only presents a simple case where all data (including the...
5
by: Tom | last post by:
VS 2003/C# Have a axWebBrowser control that will not render images. Originally our app was just launching IE7 to display an HTML page. The bitmap images were not displaying - path was correct...
14
by: ashraf02 | last post by:
i used a code from a website that allows you to display images. however everything works fine from storing the image to the database but it does not display the image. the following code is the...
3
by: piercy | last post by:
Hi, i am trying to use a list view to display a list of passed and failed items but the images are not always displaying. Sometimes the images will display fine and others they just will not appear....
3
by: Hataf | last post by:
Hi! I am having a problem in displaying images from database. This the code gallery.php <?php session_start(); if(isset($_SESSION)){} //die('ERROR:'.mysql_error());
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.