static function createOne(Image &$image, $persona_info, $coords = array()) { $thumbnail_ext = Misc::getExt($image->getCopyFile()); $sql = 'INSERT INTO tr_persona ( ps_first_name, ps_last_name, ps_width, ps_height, ps_x, ps_y, ps_ext, ps_create_date, ps_status ) VALUES ( "' . mysql_escape_string($persona_info['persona_name']) . '", "' . mysql_escape_string($persona_info['persona_last']) . '", "' . intval($coords['w']) . '", "' . intval($coords['h']) . '", "' . intval($coords['x']) . '", "' . intval($coords['y']) . '", "' . $thumbnail_ext . '", NOW(), "' . Persona::status_active . '" )'; if (!mysql_query($sql)) { throw new Exception('Не получилось создать персону. Надо перезагрузиться. (' . mysql_error() . ')'); } $persona_id = mysql_insert_id(); $thumbnail_file = SuperPath::get($persona_id . '.' . $thumbnail_ext, Persona::thumbnail_store); $cmd_command = 'convert ' . escapeshellarg($image->getCopyFile()) . ' ' . '-crop "' . $coords['w'] . 'x' . $coords['h'] . '+' . $coords['x'] . '+' . $coords['y'] . '" ' . '-thumbnail "' . Persona::thumbnail_size . 'x' . Persona::thumbnail_size . '" ' . escapeshellarg($thumbnail_file); system($cmd_command); // $src_file = SuperPath::get($image->getRealFileImage(), Image::path_src); // // $size = getimagesize($src_file); // if(!is_array($size)){ // throw new Exception('Кажеться файл оригинала не являеться изображением('.$src_file.')'); // } // // $zoom = ( $size[0] / $image->getImageInfo('im_copy_wigth') ); // echo("$zoom"); // // $cmd_command = 'convert ' . escapeshellarg($src_file) . ' -coalesce ' . // '-crop "' . ($zoom * $coords['w']) . 'x' . ($zoom * $coords['h']) . '+' . // ($zoom * $coords['x']) . '+' . ($zoom * $coords['y']) . '" '. // " -geometry " . Persona::thumbnail_size . "x" . Persona::thumbnail_size . " +repage " . // escapeshellarg($thumbnail_file); //echo $cmd_command; // system($cmd_command); return $persona_id; }
public function getCopyFile() { return SuperPath::get($this->file_name, 'big'); }
function getUsersActivity() { $logFile = SuperPath::get(UserParameters::getUserId(), LOG_COMMAND_PATH) . ".xml"; if (file_exists($logFile)) { echo file_get_contents($logFile); } else { echo '{"Log file does not exists"}'; } }