{"id":15170936,"url":"https://github.com/nathan-degraaf/wp-glide","last_synced_at":"2026-02-18T07:31:13.327Z","repository":{"id":63625704,"uuid":"569025576","full_name":"Nathan-deGraaf/wp-glide","owner":"Nathan-deGraaf","description":"A wrapper for PHP Glide through Composer","archived":false,"fork":false,"pushed_at":"2023-01-06T19:02:17.000Z","size":23,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-02-17T06:16:15.699Z","etag":null,"topics":["composer","php","wordpress"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Nathan-deGraaf.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-11-21T23:16:16.000Z","updated_at":"2022-11-22T00:19:07.000Z","dependencies_parsed_at":"2023-02-06T08:01:44.047Z","dependency_job_id":null,"html_url":"https://github.com/Nathan-deGraaf/wp-glide","commit_stats":null,"previous_names":[],"tags_count":18,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Nathan-deGraaf%2Fwp-glide","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Nathan-deGraaf%2Fwp-glide/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Nathan-deGraaf%2Fwp-glide/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Nathan-deGraaf%2Fwp-glide/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Nathan-deGraaf","download_url":"https://codeload.github.com/Nathan-deGraaf/wp-glide/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239242106,"owners_count":19605954,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["composer","php","wordpress"],"created_at":"2024-09-27T08:41:32.348Z","updated_at":"2025-10-18T15:24:21.305Z","avatar_url":"https://github.com/Nathan-deGraaf.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# WP Glide\nA wrapper for PHP Glide/composer. Built for \u003e= php@7.2 and \u003e=php@8.0.\n\n*A build off of the no longer maintained [Aginevs wp-glide wrapper](https://github.com/aginev/).*\n\n## **Install**\n\n```src\ncomposer require nathan-degraaf/wp-glide\n```\n\n## **Usage**\n\nGeneral configuration could be made at your function.php file in your theme, Though I recommend creating a dedicated glide file for your presets.\n\n### **Create Instance**\n\nIt's a singleton instance, so you will get just the same object everywhere in your application.\n\n```php\n$wpGlide = wp_glide();\n```\n\n### **Server config**\n\nYou should config WpGlide at least once in your application. The init method could have four parameters and all of them are not required.\n\n```php\n$wpGlide = wp_glide()-\u003einit([\n    // Glide server config. See: http://glide.thephpleague.com/2.0/config/setup/\n  [\n    // Image driver\n    'driver'     =\u003e 'imagick',\n    // Watermarks path\n    'watermarks' =\u003e new \\League\\Flysystem\\Filesystem(new \\League\\Flysystem\\Adapter\\Local(get_template_directory() . '/assets/img')),\n  ],\n  \n  // Base path. By default set to 'img/' and the final URL will look like so: http://example.com/BASE-PATH/SIZE-SLUG/image.jpg.\n  'img/',\n  \n  // Path to WordPress upload directory. If not set the default upload directory will be used.\n  'upload_path',\n  \n  // Cache path. If not set the cache will be placed in cache directory at the root of the default upload path.\n  'cache_path'\n]);\n```\n\n### **Register image sizes**\n\nYou should register image sizes that will be handled by Glide like so:\n\n```php\n$wpGlide-\u003eaddSize('size_name', [\n    'w'  =\u003e 1400,\n    'q'  =\u003e 80,\n    'fm' =\u003e 'webp',\n\n    'mark'      =\u003e 'watermark.png',\n    'markw'     =\u003e 1000,\n    'markh'     =\u003e 1000,\n    'markalpha' =\u003e 55,\n    'markfit'   =\u003e 'fill',\n    'markpos'   =\u003e 'center',\n\n])-\u003eaddSize('size_name_512', [\n    'w'  =\u003e 512,\n    'q'  =\u003e 80,\n    'fm' =\u003e 'webp',\n\n])-\u003eaddSize('16x9', [\n    'w'   =\u003e 16 * 10 * 2,\n    'h'   =\u003e 9 * 10 * 2,\n    'fit' =\u003e 'crop',\n    'q'   =\u003e 80,\n    'fm'  =\u003e 'webp',\n]);\n```\n\n### **Usage in templates**\n\n```html\n\u003c!-- Get Glide image URL by it's original URL --\u003e\n\u003cimg src=\"\u003c?php echo wp_glide_image('https://yourimage.com', 'size_name'); ?\u003e\" /\u003e\n```\n\nretrive base64 encoded version: \n\n```html\n\u003c!-- Get Glide image URL by it's original URL --\u003e\n\u003cimg src=\"\u003c?php echo wp_glide_base64('http://example.com/image.jpg', 'w128'); ?\u003e\" /\u003e\n```\n\n## **License**\nEverything in this repository is MIT License unless specified.\n\nMIT © 2022 Nathan deGraaf\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnathan-degraaf%2Fwp-glide","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnathan-degraaf%2Fwp-glide","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnathan-degraaf%2Fwp-glide/lists"}