Jump to content

brosjr

Members
  • Posts

    26
  • Joined

  • Last visited

Everything posted by brosjr

  1. Thank you Pikachu2000, It worked!
  2. Hi everyone; The point is, I have a string to break, it contains data and a simple code (//&//) that is exploded to generate an array of values, like: M//&// Neves//&//salas 1 a 6//&// //&// Manual//&// //&// 70165900//&// Bras//&// Text Than I get the $explodedarray: Array ( [0] => M [1] => Neves [2] => salas 1 a 6 [3] => [4] => Manual [5] => [6] => 70165900 [7] => Bras [8] => Text) The problem is, a simple if comparison is not working: if($explodedarray[0] == 'M'){ echo 'yes'; }else{ echo 'no'; } It returns 'no'. Even if I try another comparison like: if($explodedarray[5] == ''){ echo 'yes'; }else{ echo 'no'; } It also returns 'no'. Any idea? Thankx Danilo Jr.
  3. Thank you kicken but that worked just for downloading the pdf as file it didn't help to opening the document on the page. But I thied the below object tag and it worked, not as I expected once I can't handle with it's zoom options, maybe because of encoded strings, but it's fine. <object data='<?php echo data_uri($conta, 'application/pdf');?>' type='application/pdf' width='720' height='900'> </object> Thankx Danilo Jr.
  4. Hi all, On my project some PDF documents and images are storage outside the web public folder, so I just can't reach then just with a simple link and I need to display then on a page. $fileDir = '../data/contas'; For images I use the code below (this solution I found on web): $fileDir = '../data/contas/'; function data_uri($conta, $mime) { $contents = file_get_contents($conta); $base64 = base64_encode($contents); return "data:$mime;base64,$base64"; ) <img src="<?php echo data_uri($conta, 'image/png');?>" width="720"> When I see the HTML code I got <img src="data:image/png;base64,/9j/4AAQSkZJRgABA...(huge amount of string)...FXYq/wD/2Q==" width="720"> and the images are displayed correctly. The problem occurs on PDF files, I use the same function, as follow below and the PDF document is not displaying, there is no error message just a gray background where the document were to be shown. <EMBED SRC='<?php echo data_uri($conta, 'application/pdf');?>#view=FitH,top&toolbar=1&navpanes=0&scrollbar=1&zoom=scale' WIDTH="720" HEIGHT="900" ALIGN="TOP"></EMBED> When I look at the HTML code it shows: <EMBED SRC='data:application/pdf;base64,JVBERi0xLjIK...(huge amount of string)...YK#view=FitH,top&toolbar=1&navpanes=0&scrollbar=1&zoom=scale' WIDTH="720" HEIGHT="900" ALIGN="TOP"></EMBED> Any ideia how can I show the PDF files? Or there is another way to access the files outside web public folder on server to display then? Thankx Danilo Jr.
×
×
  • 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.