php - image doesn't want to show after an URL change -


before used url (www.website/all_file/profil.php?u=username) in profile , informations show perfetly including profile image.

but when change url (www.website/all_file/profil.php/username) in profile, show me information, doesn't show me profile picture of user

here code url (www.website/all_file/profil.php?u=username):

$uss = $_get['u'] ;   $m = "select username,image_user,about,contact database.users username= '$uss' ";         $de = mysqli_query($database_connection,$m);          while($rows = mysqli_fetch_assoc($de)){         $cnt = $rows['contact'];        $abt = $rows['about'];        $usern = $rows['username'];        $img = $rows['image_user'];    echo $cnt;  echo $usern;        echo <img width='100' height='100' src='image_users/".$img." '>;    

in url (www.website/all_file/profil.php/username) code, change $uss = $_get['u'] $uss = 'username';

the file stock users profile pictures (images_users) , profil.php before images_users file. problem not database because image in. thanks

after changed url, relative url no longer point same location before.

previously, when url /all_file/profil.php, image_users/$img pointed /all_file/image_users/$img - since browser knows profile.php file name (everything after last /).

after changed how use path of url, new path /all_file/profil.php/username. when give relative url base path, browser believes profil.php part of directory path. thus, browser tries load image /all_file/profile.php/image_users/$img - , fails, since means you're attempting load profile of user named image_users/$img.

replace path you're using absolute path image instead of using relative image, , image should load again:

 echo "<img width='100' height='100' src='/all_file/image_users/".$img." '>";  

Comments

Popular posts from this blog

resizing Telegram inline keyboard -

command line - How can a Python program background itself? -

php - "cURL error 28: Resolving timed out" on Wordpress on Azure App Service on Linux -