Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $dbhost = '';
- $dbuser = '';
- $dbpass = '';
- $dbname = '';
- $conn = new mysqli($dbhost, $dbuser, $dbpass, $dbname);
- $conn->set_charset('utf8');
- $id = $_GET['id'];
- $size = $_GET['size'];
- $sql = 'SELECT * FROM image WHERE id='.$id;
- $result = $conn->query($sql);
- if($parsed = $result->fetch_assoc()) $extension = $parsed["extension"];
- // open the file in a binary mode
- $name = 'images/' . sprintf("%06d", $id) ."/". $size .".". $extension;
- $fp = fopen($name, 'rb');
- // send the right headers
- header("Content-Type: image/png");
- header("Content-Length: " . filesize($name));
- // dump the picture and stop the script
- fpassthru($fp);
- exit;
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement