Keylogger's Profile User Rating: *****

Reputation: 7 Worker
Group:
Active Members
Active Posts:
348 (0.19 per day)
Joined:
14-February 11
Profile Views:
7,147
Last Active:
User is offline Jan 28 2016 10:17 AM
Currently:
Offline

Previous Fields

Dream Kudos:
0
Icon   Keylogger has not set their status

Posts I've Made

  1. In Topic: Print iframe with PDF not working

    Posted 27 Jan 2016

    The hidden class has nothing to do with the problem, and I'm reaching more conclusions. I have several online servers where I can try several things.

    I went to a new hosting and added the code I told you in my previous post...and it worked.

    Until now, the feature wasn't working at all online, only in local environment. So I compared the two response headers (of PDF while being loaded) from the server where the code doesn't work and the server where it works.

    Where it doesn't work:
    Accept-Ranges:bytes
    Cache-Control:no-cache, no-store, must-revalidate
    Connection:keep-alive
    Content-Length:52582
    Content-Type:application/pdf
    Date:Wed, 27 Jan 2016 22:15:34 GMT
    Expires:0
    Last-Modified:Wed, 27 Jan 2016 21:53:03 GMT
    Pragma:no-cache
    Server:nginx
    Vary:User-Agent
    

    Where it works:
    Accept-Ranges:bytes
    Connection:close
    Content-Length:194007
    Content-Type:application/pdf
    Date:Wed, 27 Jan 2016 22:16:50 GMT
    ETag:"520226-2f5d7-52a57fb2d5ab7"
    Last-Modified:Wed, 27 Jan 2016 22:04:08 GMT
    Server:Apache
    X-Powered-By:PleskLin
    

    I instantly notice the cache control thing, because I have set in my .htaccess something to implement that.
    <IfModule mod_headers.c>
        Header set Cache-Control "no-cache, no-store, must-revalidate"
        Header set Pragma "no-cache"
        Header set Expires 0
    </IfModule>
    

    So I went to the file and removed it and gave it another try and it seems the .htaccess is cached (?), so I tried in incognito mode but the cache persists.

    Do you see anything relevant? Might be this the problem?

    Edit: What's even more strange is that if I set an image or a page url instead of a PDF into the iframe it works, but with PDF it doesn't even though the PDF was well loaded into the iframe.
  2. In Topic: Print iframe with PDF not working

    Posted 27 Jan 2016

    View PostArtificialSoldier, on 27 January 2016 - 11:44 AM, said:

    Quote

    Keep in mind I just want this to work on chrome not other browsers.

    What does that mean? Does Chrome have a special non-standard way to print or something?

    Yes. Chrome has a print preview dialog (the image in my post) which others have not, at least that I know. In my code I detect that the user is currently viewing the page by chrome and I send the PDF to the iframe otherwise I send the PDF to a new tab.

    So this feature is just for chrome.

    Edit: If you use chrome, you can try this example at your local environment, just copy paste and get one pdf for testing (like: http://www.polyu.edu...pdf-sample.pdf)

    <html>
    	<head></head>
    	<body>
    		<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.0/jquery.min.js"></script>
    		
    		<iframe src="somefile.pdf" id="iframePdf"></iframe>
    		
    		<script type="text/javascript">
    			$(function()
    			{
    				$('#iframePdf')[0].focus();
    				$('#iframePdf')[0].contentwindow.print();
    			});
    		</script>
    	</body>
    </html>
    
  3. In Topic: Print iframe with PDF not working

    Posted 27 Jan 2016

    View PostArtificialSoldier, on 27 January 2016 - 10:27 AM, said:

    If it works locally but not on the server then try increasing that timeout to make sure that it has finished loading before you try to print it.

    Hey,

    Thanks for the response. I have already tried that. And increase for 10 seconds, but I want to be sure that wasn't setTimeout issue so I implemented a button to call the print and didn't work as well.

    Keep in mind I just want this to work on chrome not other browsers.
  4. In Topic: [Solved] CodeIgniter file_exists not working

    Posted 16 Jul 2014

    Solved.

    Since the problem was on file_exists() and it seems that the function goes to the root directory, all I had to do was to change a little the algorithm.

    function getImage($image){
    
        if(file_exists('public/images/' . $image) == FALSE || $image == null){
            return base_url() . './public/images/no_image.png';
        }
    
        return base_url() . './public/images/' . $image;
    }
    
  5. In Topic: [Solved] CodeIgniter file_exists not working

    Posted 16 Jul 2014

    Just for the record the problem is on the function file_exists ONLY.

    If I change my original function:
    function getImage($image){
    	
    	$path = base_url() . 'public/images/';
    	
    	if(file_exists($path . $image) === FALSE || $image == null){
    		return $path . "no_image.png";
    	}
    	
    	return $path . $image;
    }
    

    To this:
    function getImage($image){
    	
    	$path = base_url() . 'public/images/';
    	
    	return $path . $image;
    }
    

    It works. However, if the image does not exists in the folder I should show the image "no_image.png", that's why I use file_exists to check if exists or not.

    View PostCTphpnwb, on 15 July 2014 - 03:28 PM, said:

    What's the value of $row->picture? More importantly, what's the value returned ($path . $image) by your function?

    The value of $row->picture is users/1/image_name.jpg.

    View Postastonecipher, on 15 July 2014 - 04:51 PM, said:

    Also, what is base_url() showing?

    The `base_url()` by himself shows correctly: http://localhost/myproject/

    Edit: Btw, I'm not calling the function in my root (http://localhost/myproject/), but yes in http:// localhost/myproject/dashboard/products.

    Edit 2: A topic with the same issue http://ellislab.com/.../79524/#399857.

    The solution told there I already tried and it keep not working for me.
    They tell to use something like:
    if(file_exists(dir_name(FCPATH)."/gallery/member_picture/member_no_image.gif"))
    

    And adapting that to my code becomes:
    if(file_exists(dirname(FCPATH) . "/public/images/" . $image) === FALSE || $image == null){
        return $path . "no_image.png";
    }
    

    Which continues not to work because if I output the dirname(FCPATH):
    return dirname(FCPATH) . "/public/images/" . $image;
    //output to img src:
    <img src="C:\xampp\htdocs/public/images/users/1/image_name.jpg" class="thumbnail-image">
    

    And when I click to open the link of src in a new tab the url is:
    http:// localhost/myproject/dashboard/C:/xampp/htdocs/public/images/users/1/image_name.jpg
    


    Other solution said in that topic is to use:
    file_exists("./gallery/member_picture/member_no_image.gif"))
    

    Again, adapting to my code:
    return "./public/images/" . $image;
    //output to img src:
    <img src="./public/images/users/1/image_name.jpg" class="thumbnail-image">
    

    And when I open the link of src in a new tab I get:
    http://localhost/myproject/dashboard/public/images/users/1/image_name.jpg
    

    which is incorrect, should be:
    http://localhost/myproject/public/images/users/1/image_name.jpg
    

My Information

Member Title:
D.I.C Regular
Age:
Age Unknown
Birthday:
Birthday Unknown
Gender:

Contact Information

E-mail:
Private

Friends

Comments

Keylogger has no profile comments yet. Why not say hello?