Welcome to the GoFuckYourself.com - Adult Webmaster Forum forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact us.

 

Register GFY Rules Calendar
Go Back   GoFuckYourself.com - Adult Webmaster Forum > >
New Webmasters ask "How-To" questions here. This is where other fucking Webmasters help.

 
Thread Tools
Old 07-05-2015, 09:38 PM   #1
sylvain86
Confirmed User
 
sylvain86's Avatar
 
Industry Role:
Join Date: Mar 2015
Posts: 149
PHP and Jquery Utilities

For person who wants PHP functions :

Crop JPG image :

PHP Code:
<?php
function resize($imgFile,$output$width$height, &$error null) {
       
$attrs = @getimagesize($imgFile);
       if(
$attrs == false or $attrs[2] != IMG_JPEG)
       {
          
$error "Uploaded image is not JPEG or is not readable by this page.";
          return 
false;
       }
       if(
$attrs[0] * $attrs[1] > 3000000)
       {
          
$error "Max pixels allowed is 3,000,000. Your {$attrs[0]} x " .
                   
"{$attrs[1]} image has " $attrs[0] * $attrs[1] . " pixels.";
          return 
false;
       }
       
$ratio = (($attrs[0] / $attrs[1]) < ($width $height)) ?
                
$width $attrs[0] : $height $attrs[1];
       
$x max(0round($attrs[0] / - ($width 2) / $ratio));
       
$y max(0round($attrs[1] / - ($height 2) / $ratio));
       
$src imagecreatefromjpeg($imgFile);
       if(
$src == false)
       {
          
$error "Unknown problem trying to open uploaded image.";
          return 
false;
       }
       
$resized imagecreatetruecolor($width$height);
       
$result imagecopyresampled($resized$src00$x$y$width$height,
                 
round($width $ratio0), round($height $ratio));
       if(
$result == false)
       {
          
$error "Error trying to resize and crop image.";
          return 
false;
       }
       else
       {
          
imagejpeg($resized,$output,100);
       }
    }
?>
For Adblock detection:

Here's the code:

Code:
document.write('<div id="checker">an advertisement</div>');
Now, if Adblock check this, detection will be ready.

Add a CSS:

Code:
#checker {
    display:none;
}
If you use JQUERY, let's see the code to display something :

Code:
var REGISTER = '{YOUR_SITE_URL}';
var REQUEST = location.href;
function message(type,message,timeval,redirect) {
    if(type == 1) {
        var myclass = 'alert alert-success';
        var title = 'OK';
    }
    else {
        var myclass = 'alert-danger alert-error';
        var title = 'ERREUR';
    }
    bootbox.alert('<div class="'+myclass+'" style="padding:10px;"><h2>'+title+'</h2><p>'+message+'</p></div>');
    setTimeout(function() {
        bootbox.hideAll();
        if(redirect) {
            if(redirect=='back')
                history.back();
            else
                location.href = redirect;
        }
    }, timeval*1000);
}
$(document).ready(function() {
    if(document.getElementById("checker") == undefined && !REQUEST.match('inscription')) {
        message(0,"<u>It seems that <b>ADBLOCK</b> is activated on your browser</u>. Just deactivate it or <a href='"+REGISTER+"'>Subescrive</a>. You're going to be redirected... ",10,REGISTER);
    }
});
In this case I use jquery, bootstrap et bootbox.

If you wanna simplier:

Code:
$(document).ready(function() {
    if(document.getElementById("checker") == undefined ) {
        location.href = 'anti-adblock.php'
    }
});
Or display a message.

If you want much more, check me on Skype : sylvain.garcia1

Bye!
__________________
Sylvain - Web developer - Responsive Liveshow PHP/MySQL Script - Demo: https://www.camvore.com/demo/en/ - Skype ID: sylvain.garcia1 - Email: [email protected] - Website : https://www.necatis.com
sylvain86 is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook
 
Go Back   GoFuckYourself.com - Adult Webmaster Forum > >

Bookmarks

Tags
var, $width, $height, false;, return, $attrs[1], $error, $attrs[0], false, $ratio;, adblock, jquery, image, location.href, code, $ratio, check, php, $src, detection, max0, crop, title, undefined, uploaded



Advertising inquiries - marketing at gfy dot com

Contact Admin - Advertise - GFY Rules - Top

©2000-, AI Media Network Inc



Powered by vBulletin
Copyright © 2000- Jelsoft Enterprises Limited.