Jump to content

how to space out my review texts


piano0011

Recommended Posts

I have tried it and hope that I did the right thing: but it is still big...

 

<div>
    <img class="small_logo" src="includes/pictures/pc101.gif" alt="pianocourse101 logo"/>
    </div>

CSS code:

.small_logo {
   position: absolute;
   top: 200px;
   left: 200px;
   width: 212px;
   height: 116px;
   
  

   
  }

image.thumb.png.6f262b3fb48ce957ebd2be7a906aa247.png

Link to comment
Share on other sites

It resizes OK for me

<html>
<head>
<meta name="generator" content="PhpED 18.0 (Build 18044, 64bit)">
<title>Image sizes</title>
<style type="text/css">
.small_logo {
   position: absolute;
   top: 200px;
   left: 200px;
   width: 212px;
   height: 116px;
  }
</style>
</head>
<body>
<div>
    <img class="small_logo" src="pc101.gif" alt="pianocourse101 logo"/>
</div>
<br>Normal image for comparison<br>
<div>
    <img src="pc101.gif" alt="pianocourse101 logo"/>
</div>

</body>
</html>

(The smaller image overlays the normal one because of the positioning in your style definition)

Where have you defined your style?

Capture4.PNG

Link to comment
Share on other sites

I have another issue with my default picture in my header.php and that is, when browsing and using the development tool, it is showing up as two img pictures but I only have one default img in this code: I will try moving my other contents first and see how that goes!

 

 <?php
              session_start();
                if (isset($_SESSION['u_uid'])) {
                   echo '<form action="includes/logout.php" method="POST">  
                   <button type="submit" name="submit">Logout</button>
                </form>';

 include_once 'includes/dbh.php';

                $sql = "SELECT * FROM users;";

$stmt = mysqli_stmt_init($conn);

if (!mysqli_stmt_prepare($stmt, $sql)) {
   echo 'SQL error';
   
} else {
    
    mysqli_stmt_execute($stmt);
    $result = mysqli_stmt_get_result($stmt);
    $resultCheck = mysqli_num_rows($result);

    if($resultCheck > 0) {
      while ($row = mysqli_fetch_assoc($result)) {
        $id = $row['user_id'];
        $sqlImg = "SELECT * FROM profileimg WHERE userid = ?;";

        $stmt = mysqli_stmt_init($conn);

        if (!mysqli_stmt_prepare($stmt, $sqlImg)) {
           header("Location: index.php?login=error");
           exit();
        } else {
            mysqli_stmt_bind_param($stmt, "i", $id);
            mysqli_stmt_execute($stmt);
            $resultImg = mysqli_stmt_get_result($stmt);

            while ($rowImg = mysqli_fetch_assoc($resultImg)) {
              echo "<div>";
                  if ($rowImg['status'] == 0) {
                    $filename = "includes/uploads/profile".$id."*";
                    $fileinfo = glob($filename);
                    $fileext = explode(".", $fileinfo[0]);
                    $fileactualext = $fileext[1];
                    echo "<img class='profile_picture' src='includes/uploads/profile".$id.".".$fileactualext."?".mt_rand()." >";
                  } else {
                    echo "<img class='default_picture' src='includes/uploads/profiledefault.jpg'>";
                  }
                 

                echo"</div>";
              }
            }
            }
        } 

This is my CSS code:

.default_picture {
   position: relative;
   left: 150px;
   bottom: 50px;
   width: 100px;
   height: 60px;

}

image.png.a911feabf47a3c761e001a411850b385.png

Link to comment
Share on other sites

I also forgot to mention that for the above logo problem, it will only work if I include the !important, Does this mean, that something must have overriden the following code?

 

.pc101 {
   position: absolute;
   top: 400px;
   left: 700px;
   width: 402px !important;
   height: 116px !important;
   
  

   
  }

 

Link to comment
Share on other sites

you are getting two images because your query is not doing what you want, probably because you are just copying things together instead of writing the code so that it does what you have defined.

you are querying for all the rows from the users table. you should be querying for just the row that matches the current logged in user, and as has already been written in a reply, don't use a loop to retrieve data when a query will match just one row. you should also be using a single JOIN query, between the users and the profileimg tables. in fact, for what you are doing, getting the status from the profileimg table, you only need to query that table. you are not actually using any data from the users table query that you don't already have from your login session variable.

Link to comment
Share on other sites

A qustion about this line of code, if I may

echo "<img class='profile_picture' src='includes/uploads/profile".$id.".".$fileactualext."?".mt_rand()." >";
                                       |
                              unclosed single quote 

As you can see, the src name of the image has no closing quote so I (and the PHP processor) have difficulty in knowing where the name ends.

Is the mt_rand() supposed to be part of the name?

  • If so, how do expect to ever find that file?
  • If not, why is there?
Link to comment
Share on other sites

14 hours ago, piano0011 said:

I tried it without the div class but still can't get it to shrink.....

Thanks for pointing that out.. i will check the closing quote and yes, that function is meant to be there according to a video i watched. It is meant to give the user the ability to upload any files.

Link to comment
Share on other sites

I have checked the video again and the only thing missing is that he is using an echo div class but as you mentioned earlier that div class does not work too well with images. I should look up more into this but how come it doesn't work too well with images? He actually did that following in the code: I have tried closing the single quote in my 2nd attachment but it is still showing as the following. I will upload the video source as well because I did exactly as he did in the tutorial... Cheers!

 

while ($rowImg = mysqli_fetch_assoc($resultImg)) {
             echo "<div class ='user-container'>";
                  if ($rowImg['status'] == 0) {
                    $filename = "includes/uploads/profile".$id."*";
                    $fileinfo = glob($filename);
                    $fileext = explode(".", $fileinfo[0]);
                    $fileactualext = $fileext[1];
                    echo "<img src='includes/uploads/profile".$id.".".$fileactualext."?".mt_rand()."'>";
                  } else {
                    echo "<img src='includes/uploads/profiledefault.jpg'>";
                  }
                 

                echo"</div>";
              }
            }
            }
        } 

and I did this in my CSS

div.user-container {

// etc

}
if (!mysqli_stmt_prepare($stmt, $sql)) {
   echo 'SQL error';
   
} else {
    
    mysqli_stmt_execute($stmt);
    $result = mysqli_stmt_get_result($stmt);
    $resultCheck = mysqli_num_rows($result);

    if($resultCheck > 0) {
      while ($row = mysqli_fetch_assoc($result)) {
        $id = $row['user_id'];
        $sqlImg = "SELECT * FROM profileimg WHERE userid = ?;";

        $stmt = mysqli_stmt_init($conn);

        if (!mysqli_stmt_prepare($stmt, $sqlImg)) {
           echo 'SQL error';
           
        } else {
            mysqli_stmt_bind_param($stmt, "i", $id);
            mysqli_stmt_execute($stmt);
            $resultImg = mysqli_stmt_get_result($stmt);

            while ($rowImg = mysqli_fetch_assoc($resultImg)) {
           // echo "<div class ='user-container'>";
                  if ($rowImg['status'] == 0) {
                    $filename = "includes/uploads/profile".$id."*";
                    $fileinfo = glob($filename);
                    $fileext = explode(".", $fileinfo[0]);
                    $fileactualext = $fileext[1];
                    echo "<img class='profile_picture' src='includes/uploads/profile'".$id.".".$fileactualext."?".mt_rand().">";
                  } else {
                    echo "<img class='default_picture' src='includes/uploads/profiledefault.jpg'>";
                  }
                 

             //   echo"</div>";
              }
            }
            }
        } 

image.png.9d66a2b5802dd0be58ae981e9fd9bbb1.png

 

 

Link to comment
Share on other sites

Apologies Macgyver! You are a right! Mmtuts made a mistake by not including a where statement in selecting a particular user. I guess everyone makes mistakes but that solves the problem... Love the Macgyver show by the way! I also found it hard to get things working with a div class for images as Barand pointed out. I should read more about how to use a div class but should I just avoid it for images? Most tutorials use it for images but with different elements inside it?

 

Edited by piano0011
Link to comment
Share on other sites

This is interesting... I have chrome version 69 I think but it said that it is up to date but my CSS is not refreshing quick enough compared with IE. I don't even think it is refreshing at all because it has looked the same for the past few days. I am not sure if it is just my setting ..

 

 

Link to comment
Share on other sites

With regard to picture profile, I tried to upload certain pictures and some of them are displayed correctly but some are not. Is there a way that I can make all the pictures to be shown the right angle? Some of them are rotated to 180 degrees while some to 90 degrees... but some are shown correctly....

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.