Jump to content

M.O.S. Studios

Members
  • Posts

    300
  • Joined

  • Last visited

Community Answers

  1. M.O.S. Studios's post in Validating e was marked as the answer   
    function spamTest($header){ $output_array = preg_grep('/^(X-Spam-Score:)\s([-+]?\d{1,3}\.\d)?/i', explode("\n", $header)); list($xSpamScore, $score) = explode(": ", $output_array[array_key_first($output_array)]); return ($score < 5); } I ran the email header into this and it seems to work.
  2. M.O.S. Studios's post in Quick members area was marked as the answer   
    Fancy isn't important as I am the only one using it.
     
    However easy is ideal.
     
    I was thinking of using htaccess, htpasswd, .htaccess. I have never used those before, but I think they will be pretty simple to set up.
     
    My only concern is that I use Ajax to reference other pages, and I am worry that will interfere 
  3. M.O.S. Studios's post in Making a Image from CSV was marked as the answer   
    Figured it out.
     
    Here is my round about way to take a CSV file, and visualize it as a table.
     
    <?php require('fpdf.php'); $file = file.csv'; function near5($v){ return round($v * 2) / 2; } function content($file){ $header = array(); if (($handle = fopen($file, "r")) !== FALSE){ $body = array(); $header = fgetcsv($handle); $header[0] = 'Category/Weight(Lbs)'; while (($data = fgetcsv($handle)) !== FALSE){ $body[] = $data; } fclose($handle); } return array($header, $body); } class PDF extends FPDF{ // Simple table function BasicTable($header, $data, $kcal){ // Header $first = 30; foreach($header as $col){ $v = is_numeric($col) ? round(($col*2.2),1) : $col; $this->Cell($first,7,$v,1,0,'C'); $first = 10; } $this->Ln(); // Data foreach($data as $row){ $first = 30; foreach($row as $col){ $v = (is_numeric($col)) ? near5($col/$kcal) : $col; $this->Cell($first,7,$v,1,0,'C'); $first = 10; } $this->Ln(); } } } // Column headings content($file); list($header, $row) = content($file); // Data loading $pdf = new PDF(); $pdf->SetFont('Arial','',5); $pdf->AddPage(); $pdf->BasicTable($header,$row, $kcal); $output = $pdf->Output('S'); $im = new imagick(); $im->setResolution(300, 300); $im->readImageBlob($output); $im->setImageFormat('png'); $im->setImageCompression(imagick::COMPRESSION_JPEG); $im->setImageCompressionQuality(100); $im->borderImage("#ffffff", 20, 20); $im->trimImage(0.3); $im->setImagePage($im->getImageWidth(), $im->getImageHeight(), 0, 0); header("Content-Type: image/" . $im->getImageFormat()); echo $im->getImageBlob(); $im->clear(); $im->destroy(); ?>  
  4. M.O.S. Studios's post in Ajax on safari was marked as the answer   
    Got it working
     
    function UrlWorks(instaUrl){     var url = '../' + instaUrl.split('.com/p/').pop().toLowerCase();       jQuery.ajax({         url: url,         datatype: 'text',         type: 'Get',         success: function(){window.location.href = url},         error: function(){window.location.href = instaUrl}     }); }   $('a.sbi_photo[href]').each(function() {     var $t = $(this);     var newHref = $t.attr('href');     $t.removeAttr( "href" );     $t.click(function(){UrlWorks(newHref);}); });
×
×
  • 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.