PHP Classes

File: php/functions-pic.php

Recommend this page to a friend!
  Classes of Ann   Purp Project   php/functions-pic.php   Download  
File: php/functions-pic.php
Role: Auxiliary script
Content type: text/plain
Description: Auxiliary script
Class: Purp Project
Application to manage photo albums
Author: By
Last change: Update of php/functions-pic.php
Date: 1 year ago
Size: 1,638 bytes
 

Contents

Class file image Download
<?php

// session_start();
// require_once 'includes/connect-db.php';

// $result = mysqli_query($connect, $query) or die("?????? " .
// mysqli_error($connect));

 
function can_upload($file){
   
// ???? ??? ??????, ?????? ???? ?? ??????
   
if($file['name'] == '')
        return
'?? ?? ??????? ????.';
   
   
/* ???? ?????? ????? 0, ?????? ??? ?? ?????????? ?????????
    ??????? ??-?? ????, ??? ?? ??????? ??????? */
   
if($file['size'] == 0)
        return
'???? ??????? ???????.';
   
   
// ????????? ??? ????? ?? ????? ? ???????? ??????
   
$getMime = explode('.', $file['name']);
   
// ??? ?????????? ????????? ??????? ??????? - ??????????
   
$mime = strtolower(end($getMime));
   
// ??????? ?????? ?????????? ??????????
   
$types = array('jpg', 'png', 'gif', 'bmp', 'jpeg');
   
   
// ???? ?????????? ?? ?????? ? ?????? ?????????? - return
   
if(!in_array($mime, $types))
        return
'???????????? ??? ?????.';
   
    return
true;
  }
 
  function
make_upload($file){
   
// ????????? ?????????? ??? ????????: ????????? ????? ? name
   
$name = mt_rand(0, 10000) . $file['name'];
   
copy($file['tmp_name'], 'img/' . $name);

   
// $query_add ="INSERT INTO `pict`(`id`, `path`, `album-id`, `cathegory-id`, `title`) VALUES (NULL, $name,'[value-3]','[value-4]','[value-5]')";
 
}