php - Broken img only on Chrome -


so in here (on bottom of page) can see (only if using chrome) broken image @ bottom left.

it turns out accessing directly works. chrome console gives 404 error image.

i'm using php file serve image. show arg , use readfile serve image. (the code works, seen in other browsers or accessing directly)

i don't know what's deal chrome.

any appreciated!

i'm using wordpress base, , i'm using following php file filter users ids able see images.

sorry if code messy. i'm still learning!

<?php  define('wp_use_themes', false); require('./wp-blog-header.php');  $current_user = wp_get_current_user(); $current_user_id = $current_user->id;  //save idlength compare  $idlength=strlen($current_user_id);  //check arg if (isset($_get['show'])) {      $img="../subidas_cliente/{$_get['show']}";      //check whether file exists     if (file_exists($img)){          //admin ids image          if($current_user_id==2||$current_user_id==10||$current_user_id==12||$current_user_id==13){             readfile($img);         }          else{              //compare ids image , requester             $tmp=substr($img,0,$idlength);             $r=strcmp($tmp, $current_user_id);               if ($r==0){                  $mime_type = mime_content_type($img);                 header('content-type: '.$mime_type);                  //readfile if ids equal                 readfile($img);              //exit if different (return image testing purposes)             }else{                 header('content-type: image/jpeg');                 readfile('../subidas_cliente/default.jpg');             }         }      }else {         header('content-type: image/jpeg');         readfile('../subidas_cliente/default.jpg');     } }else{     header('content-type: image/jpeg');     readfile('../subidas_cliente/default.jpg'); }  ?> 

turns out loading wordpress functions troublesome (and buggy). ended transfering id through session (session_start , $_session['']) variable , solved everything.


Comments

Popular posts from this blog

asp.net mvc - SSO between MVCForum and Umbraco7 -

Python Tkinter keyboard using bind -

ubuntu - Selenium Node Not Connecting to Hub, Not Opening Port -