Jump to content
piano0011

how to space out my review texts

Recommended Posts

I have shown you how to do it an hour ago.

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
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

Share this post


Link to post
Share on other sites

You are right! It does work without the div class... I guess I have been watching this video and it must be for a different purpose? He is using div for the font awesome pictures:

 

Share this post


Link to post
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

Share this post


Link to post
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;
   
  

   
  }

 

Share this post


Link to post
Share on other sites

Sounds like it. You need to search out where it is happening.

Share this post


Link to post
Share on other sites

thanks and with regard to my default_picture, I am not sure why it is displaying two pictures. I have checked and there are no other background image... I guess, I will just keep checking on it...

Share this post


Link to post
Share on other sites

When you say "no other background image" does that mean there is one?

Share this post


Link to post
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.

Share this post


Link to post
Share on other sites
Posted (edited)

I have checked and just to clear things here, there is no background image and i have not used a loop. There is no for loop, i am just displaying the $row. 

Edited by piano0011

Share this post


Link to post
Share on other sites

You have 2 nested while() loops

Share this post


Link to post
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?

Share this post


Link to post
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.

Share this post


Link to post
Share on other sites

the mt_rand() is there to help insure that the image will be requested from the server, rather than to use a cached image.

Share this post


Link to post
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

 

 

Share this post


Link to post
Share on other sites
Posted (edited)

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

Share this post


Link to post
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 ..

 

 

Share this post


Link to post
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....

Share this post


Link to post
Share on other sites

Can you attach a few (3 with different rotations) images that exhibit this behavior

Share this post


Link to post
Share on other sites

At the moment, I have just one picture that is not displaying correctly as shown below but most of them are ok. 

 

image.png.51e2829bf5747db8b32cae1b29926a21.png

 

 

Share this post


Link to post
Share on other sites

That's as much use as a chocolate teapot and not what was requested.

Share this post


Link to post
Share on other sites

My apologies but I guess I shouldn't worry too much about this as this is the only picture that is out of place.. The rest are displayed okay...

 

 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×

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.