Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function query_vars($public_query_vars) {
- $public_query_vars[] = "imagem";
- $public_query_vars[] = "id";
- $public_query_vars[] = "w";
- $public_query_vars[] = "h";
- $public_query_vars[] = "m";
- return $public_query_vars;
- }
- add_filter('query_vars', 'query_vars');
- function add_rewrite_rules( $wp_rewrite ){
- $new_rules = array();
- $new_rules['imagem/(.*)_(.*)x(.*)_(.*).jpg'] = 'index.php?imagem=true'.
- '&id='.$wp_rewrite->preg_index(1).
- '&w='.$wp_rewrite->preg_index(2).
- '&h='.$wp_rewrite->preg_index(3).
- '&m='.$wp_rewrite->preg_index(4);
- $wp_rewrite->rules = $new_rules + $wp_rewrite->rules;
- }
- add_action('generate_rewrite_rules', 'add_rewrite_rules');
- function template_redirect_intercept() {
- if (get_query_var('imagem')) {
- $id = get_query_var('id');
- $w = get_query_var('w');
- $h = get_query_var('h');
- switch (get_query_var('m')) {
- case 1:
- $m = 'crop';
- break;
- }
- include ('getImage2.php'); // my class
- exit;
- }
- }
- add_action( 'template_redirect', 'template_redirect_intercept' );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement