{"id":13530374,"url":"https://github.com/Sybio/GifCreator","last_synced_at":"2025-04-01T18:31:38.147Z","repository":{"id":4794926,"uuid":"5947726","full_name":"Sybio/GifCreator","owner":"Sybio","description":"GifCreator is a PHP class that creates animated GIF from multiple images","archived":false,"fork":false,"pushed_at":"2021-09-18T18:40:16.000Z","size":120,"stargazers_count":326,"open_issues_count":21,"forks_count":149,"subscribers_count":25,"default_branch":"master","last_synced_at":"2025-03-26T04:05:28.507Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Sybio.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2012-09-25T09:29:58.000Z","updated_at":"2025-01-30T00:25:58.000Z","dependencies_parsed_at":"2022-09-05T04:01:42.859Z","dependency_job_id":null,"html_url":"https://github.com/Sybio/GifCreator","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Sybio%2FGifCreator","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Sybio%2FGifCreator/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Sybio%2FGifCreator/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Sybio%2FGifCreator/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Sybio","download_url":"https://codeload.github.com/Sybio/GifCreator/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246691578,"owners_count":20818535,"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":[],"created_at":"2024-08-01T07:00:48.918Z","updated_at":"2025-04-01T18:31:37.904Z","avatar_url":"https://github.com/Sybio.png","language":"PHP","readme":"# ================================\n# GifCreator\n# ================================\n\nGifCreator is a PHP class to create animated GIF from multiple images\n\n### For what ?\n\nThis class helps you to create an animated GIF image: give multiple images and their duration and that's it !\n\n### Usage\n\n**1 - Creation:**\n\n```php\n// Create an array containing file paths, resource var (initialized with imagecreatefromXXX), \n// image URLs or even binary code from image files.\n// All sorted in order to appear.\n$frames = array(\n    imagecreatefrompng(\"/../images/pic1.png\"), // Resource var\n    \"/../images/pic2.png\", // Image file path\n    file_get_contents(\"/../images/pic3.jpg\"), // Binary source code\n    'http://thisisafakedomain.com/images/pic4.jpg', // URL\n);\n\n// Create an array containing the duration (in millisecond) of each frames (in order too)\n$durations = array(40, 80, 40, 20);\n\n// Initialize and create the GIF !\n$gc = new GifCreator();\n$gc-\u003ecreate($frames, $durations, 5);\n```\nThe 3rd parameter of create() method allows you to choose the number of loop of your animated gif before it stops.\nIn the previous example, I chose 5 loops. Set 0 (zero) to get an infinite loop.\n\n**2 - Get the result:**\n\nYou can now get the animated GIF binary:\n\n```php\n$gifBinary = $gc-\u003egetGif();\n```\n\nThen you can show it in the navigator:\n\n```php\nheader('Content-type: image/gif');\nheader('Content-Disposition: filename=\"butterfly.gif\"');\necho $gifBinary;\nexit;\n```\n\nOr save it in a folder as a GIF:\n\n```php\nfile_put_contents('/myfolder/animated_picture.gif', $gifBinary);\n```\n\n### Behavior\n\n- The transparency is based on the first given frame. It will be saved only if you give multiple frames with same transparent background.\n- The dimensions of the generated GIF are based on the first frame. If you need to resize your frames to get the same dimension, you can use \nthis class: https://github.com/Sybio/ImageWorkshop\n\n### About\n\nThe class reuses some part of code of \"GIFEncoder.class.php\" by László Zsidi (thanks to him).","funding_links":[],"categories":["Libraries","图像","图像 Imagery","目录","Imagery","图像( Imagery )"],"sub_categories":["PHP","图像 Imagery"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FSybio%2FGifCreator","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FSybio%2FGifCreator","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FSybio%2FGifCreator/lists"}