Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- //You can try this out at http://home.xtil.net:8000/reversegif/index.php
- //It might not be online at all times, though.
- //This code is licensed as public domain. Do whatever you want with it.
- //Requires Linux, an HTTP server, PHP, and ImageMagick.
- if ($_FILES["image"]) {
- if ($_FILES["image"]["error"] <= 0) {
- if ($_FILES["image"]["type"] == "image/gif") {
- $id = rand(100, 999);
- $store = dirname(__FILE__) . "/tmp/";
- move_uploaded_file($_FILES["image"]["tmp_name"], $store . $id . "original.gif");
- exec("convert -coalesce " . $store . $id . "original.gif " . $store . $id . ".png");
- exec("ls -1vr --color=none " . $store . $id . "\-*", $filelist);
- exec("convert -delay " . intval($_POST["framerate"]) . " -loop 0 " . implode(" ", $filelist) . " " . $store . "../reversed/" . $id . ".gif");
- exec("rm " . $store . $id . "*");
- header("Location: reversed/" . $id . ".gif");
- }
- else {
- echo "File should be a gif.";
- }
- }
- else {
- echo "Error " . $_FILES["image"]["error"];
- }
- }
- else {
- ?><html><head><title>Reverse GIF</title></head><body>
- <p>Here's a quick and easy way to reverse the frame order of an animated GIF. Please download the output image and host it elsewhere, rather than hotlinking!</p>
- <form action="index.php" method="post" enctype="multipart/form-data"><fieldset>
- Image (max size 1MB): <input type="file" name="image" /><br />
- Framerate (centiseconds): <input type="text" name="framerate" value="10" /><br /><input type="submit" value="Reverse it" />
- </fieldset></form></body></html><?php
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement