This should actually work for you:
function header_resized_img () {
$image = wp_get_image_editor($_GET['path']);
$height = $_GET['height'];
$width = $_GET['width'];
if (!is_wp_error($image)) {
$image->resize(9999, $height, false);
$orig_size = $image->get_size();
$image->crop($orig_size['width']/2-$width/2, $orig_size['height']/2-$height/2, $width, $height);
$image->stream( $mime_type="image/jpeg");
}
}
and include your function somewhere in the template:
header_resized_img();
Then try accessing this URL:
http://example.com/image/?width=500&height=400&path=some-url
To generate your image.
Related Posts:
- How to get a URL parameter from a URL with get_query_var?
- How to remove query string from static resources
- query_vars Filter: Would You Ever Use It When $_GET is Available and You Don’t Need a ‘Pretty’ URL?
- when the incoming url is a query, in which function does WP begin to work with it?
- Accessing custom URL parameters
- Remove query string except from google map api
- Sorting by 2 Custom Fields + Post Title
- Use “name” query string to refer to form field instead of pagename
- How to echo a string in custom posts args from a custom field?
- Custom query vars empty
- How to append short url to specific external links
- How can I get query string values in JavaScript?
- What is the difference between URL parameters and query strings?
- How to get GET (query string) variables in Express.js on Node.js?
- Node.js: Difference between req.query[] and req.params
- How to get URL parameter using jQuery or plain JavaScript?
- Get querystring from URL using jQuery [duplicate]
- Fastest way to implode an associative array with keys
- Get query string parameters url values with jQuery / Javascript (querystring)
- use query string in URL to display content on the page
- rewrite rules and querystring
- Paginate Link generate additional #038; whenever my Url have multiple Query String
- Querystring parameter getting lost in rewrite rule
- order by second word in title?
- Is it possible to add an admin page using add_submenu_page() and pass a var in the query string?
- Can ‘numberposts’ be passed in the URL query string?
- How can I include a query string with get_permalink
- Redirect to post after submission with Gravity Forms? [closed]
- Visually change theme via query string?
- How can I Rewrite a ‘page’ URL based on query string parameters?
- Passing & Reading URL Parameters with URL re-writing
- Prevent redirect to page/page when reserved term ‘name’ in $_POST when value is a page/post title
- Can’t pass table to $wpdb->prepare
- How can I get the [video] shortcode to allow query string parameters?
- How do I add a php statement to a jQuery string
- Showing random content / pictures from earlier posts in a sticky post?
- Add custom URLs to WordPress’s XML sitemap
- How to get “extended” path info from URL in a plugin
- Concatenate site_url and string doesn’t work
- Query_posts $query_string
- Passing array of strings to a SQL statement in a WordPress plugin
- Wp Login redirect strips parameters from url
- Is doing_wp_cron a necessary query string when scheduling cron.php as a cron job?
- Query string becomes encoded when a static page is used as homepage
- Add query string to url and display it as normal url part /folder/
- Meta box io oembed returns list not array
- Count number of published posts by type
- How to order results by date and meta key?
- Remove Query String from URL on Redirect – Redirection Plugin
- Change gravity forms confirmation redirect query string to include entry id [closed]
- How do you Query posts with nothing in common?
- mod_rewrite empties QUERY_STRING if starting with number [closed]
- Can’t add external rewrites
- Query String being Removed Creating a Pagination Issue within a Custom Plugin
- How to remove query string from static resource in WordPress?
- Remove query string specific key value
- Check if page is embeded
- urlencode query string in gravity forms confirmation redirect
- get_posts – find out if querystring was crap and fallback is used
- how query string in wordpress receive the value other than post and page [duplicate]
- Creating a Video Content Page (how to use query strings in wordpress)- Help!
- Detect permalinks when passing querystring in REST API requests
- Replace text string on individual page
- Keep query string in url after executing a serch
- How to build a shortcode which can insert a query string into a DB table
- How to get “string” away – replaced with “nothing” [closed]
- pass query string on url to filter media
- How to stop WordPress Search form from searching only in current page?
- add_rewrite_rule not working for me
- how to make URL link query string
- Undefined index: b in /path/file.php relating to querystring parameters
- magnific popup + gravity form query string not passing
- How to remove ?wp-mce from page source?
- Replace shortcode in substring
- WordPress URL Rewrite for dynamic and customized URL
- Insert custom PHP head above in WP pages
- Custom query, multiple custom keys
- how to access query string in wordpress?
- Multiple Category Query
- Search Query for Multiple Terms In Same Taxonomy
- Grab values from the query string to fill in hidden fields in ninja forms [closed]
- WordPress function and string as variable?
- How to append a query string to pagination?
- WordPress Query String: get_posts(‘cat=5’) vs WP_Query( ‘cat=5’) vs URL: /site/?cat=5
- Is there a query string for edit.php to show all posts that have no custom taxonomy terms?
- How to translate “$before” with get text in get_the_term_list?
- How to grab query string from wp-content/uploads/.*
- Can a link in WordPress contain a query string that is picked up as $_POST
- Querystring value being stripped from site_url()
- Adding query string parameters to URL with same name as custom post type gives 404 error
- How to Include Fields in Query String When Making Request of WordPress.org Plugin API?
- How to return a string that has a jQuery and Ajax inside in a shortcode?
- Filter results from a serialized string to use on statistics
- How to load this code on function.php
- Htaccess rewrite based on query string, not working [closed]
- How would I get WordPress to parse /mypage/area/value as /mypage/?area=value?
- PHP $_REQUEST array empty
- WP adds long version query strings to CSS and JS files
- Custom functions for string data calculations
- Add rewrite rule to make Woocommerce product category page seo friendly