Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $image = $_GET['image'];
- $regex = '#([a-zA-Z0-9]+)_thumb\.(png|jpe?g|gif)$#';
- preg_match($regex, $image, $matches);
- unset($image);
- unset($regex);
- $directory = '/home/user/public_html/images';
- $image = sprintf("%s/%s.%s", $directory, $matches[1], $matches[2]);
- if(file_exists($image)) {
- $thumb = sprintf("%s/%s_thumb.%s", $directory, $matches[1], $matches[2]);
- shell_exec(sprintf("convert -interlace line -quality 80 -size 220x220 %s -resize 220 -profile '*' %s", $image, $thumb));
- echo 'Image Created Successfully!';
- } else {
- header("Status: 404 Not Found");
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement