Advertisement
Guest User

Resize function =D

a guest
Jul 3rd, 2015
228
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.84 KB | None | 0 0
  1.  
  2. public function saveImage($name,$image_name){
  3. $stmt = $this->db->prepare("INSERT INTO images(image_name,image_image)
  4. VALUES(:name, :image_name)");
  5.  
  6. $stmt->bindparam(":name", $name);
  7. $stmt->bindparam(":image_name", $image_name);
  8. $stmt->execute();
  9. return $stmt;
  10. }
  11.  
  12.  
  13. public function getImages(){
  14. $limit = 50;
  15. $stmt = $this->db->prepare("SELECT * FROM images ORDER BY image_id DESC LIMIT :limit");
  16. $stmt->bindParam(':limit', $limit, PDO:: PARAM_INT);
  17. $stmt->execute();
  18.  
  19. if ($stmt->rowCount() > 0) {
  20. $stmt->setFetchmode(PDO::FETCH_ASSOC);
  21. $iterator = new IteratorIterator($stmt);
  22.  
  23. foreach ($iterator as $row) {
  24. echo '<div class="articles"><img src="images/'.$row['image_name'].'"';
  25. echo '</div>';
  26.  
  27.  
  28. }
  29. }
  30. else {
  31. echo "Er zijn geen foto's";
  32. }
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement