mirror of
https://github.com/wavelog/wavelog.git
synced 2026-03-22 10:24:14 +00:00
userdir for eqsl
This commit is contained in:
@@ -12,14 +12,15 @@ class eqsl extends CI_Controller {
|
||||
public function index() {
|
||||
|
||||
$this->lang->load('qslcard');
|
||||
$folder_name = "images/eqsl_card_images";
|
||||
$this->load->model('eqsl_images');
|
||||
$folder_name = $this->eqsl_images->get_imagePath('p');
|
||||
$data['storage_used'] = $this->sizeFormat($this->folderSize($folder_name));
|
||||
|
||||
|
||||
// Render Page
|
||||
$data['page_title'] = "eQSL Cards";
|
||||
|
||||
$this->load->model('eqsl_images');
|
||||
|
||||
$data['qslarray'] = $this->eqsl_images->eqsl_qso_list();
|
||||
|
||||
$this->load->view('interface_assets/header', $data);
|
||||
@@ -547,13 +548,13 @@ class eqsl extends CI_Controller {
|
||||
}
|
||||
echo $content;
|
||||
$filename = uniqid().'.jpg';
|
||||
if (file_put_contents('images/eqsl_card_images/' . '/'.$filename, $content) !== false) {
|
||||
if (file_put_contents($this->Eqsl_images->get_imagePath('p') .'/'. $filename, $content) !== false) {
|
||||
$this->Eqsl_images->save_image($id, $filename);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
header('Content-Type: image/jpg');
|
||||
$image_url = base_url('images/eqsl_card_images/'.$this->Eqsl_images->get_image($id));
|
||||
$image_url = base_url($this->Eqsl_images->get_imagePath() .'/'. $this->Eqsl_images->get_image($id));
|
||||
header('Location: ' . $image_url);
|
||||
}
|
||||
|
||||
@@ -608,7 +609,7 @@ class eqsl extends CI_Controller {
|
||||
return $error;
|
||||
}
|
||||
$filename = uniqid().'.jpg';
|
||||
if (file_put_contents('images/eqsl_card_images/' . '/'.$filename, $content) !== false) {
|
||||
if (file_put_contents($this->Eqsl_images->get_imagePath('p') .'/'. $filename, $content) !== false) {
|
||||
$this->Eqsl_images->save_image($id, $filename);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -35,6 +35,27 @@ class Eqsl_images extends CI_Model {
|
||||
return $this->db->get('eQSL_images');
|
||||
}
|
||||
|
||||
// return path of esql file : u=url / p=real path //
|
||||
function get_imagePath($pathorurl='u') {
|
||||
$eqsl_dir = "eqsl_card";
|
||||
// test if new folder directory exist //
|
||||
$data_userdir = $this->config->item('userdatadir');
|
||||
if (isset($data_userdir)) {
|
||||
if (!file_exists(realpath(APPPATH.'../').'/'.$data_userdir)) {
|
||||
mkdir(realpath(APPPATH.'../').'/'.$data_userdir, 0755, true);
|
||||
}
|
||||
if (!file_exists(realpath(APPPATH.'../').'/'.$data_userdir.'/'.$eqsl_dir)) {
|
||||
mkdir(realpath(APPPATH.'../').'/'.$data_userdir.'/'.$eqsl_dir, 0755, true);
|
||||
}
|
||||
if ($pathorurl=='u') {
|
||||
return $data_userdir.'/'.$eqsl_dir;
|
||||
} else {
|
||||
return realpath(APPPATH.'../').'/'.$data_userdir.'/'.$eqsl_dir;
|
||||
}
|
||||
} else {
|
||||
return 'images/eqsl_card_images';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
@@ -2471,9 +2471,14 @@ function deleteQsl(id) {
|
||||
</script>
|
||||
<script>
|
||||
function viewEqsl(picture, callsign) {
|
||||
<?php
|
||||
$CI =& get_instance();
|
||||
$CI->load->model('Eqsl_images');
|
||||
echo 'var eqslpath = "'.$CI->Eqsl_images->get_imagePath().'"; ';
|
||||
?>
|
||||
var baseURL= "<?php echo base_url();?>";
|
||||
var $textAndPic = $('<div></div>');
|
||||
$textAndPic.append('<img class="img-fluid" style="height:auto;width:auto;"src="'+baseURL+'images/eqsl_card_images/'+picture+'" />');
|
||||
$textAndPic.append('<img class="img-fluid" style="height:auto;width:auto;"src="'+baseURL+eqslpath+'/'+picture+'" />');
|
||||
var title = '';
|
||||
if (callsign == null) {
|
||||
title = 'eQSL Card';
|
||||
|
||||
@@ -607,9 +607,12 @@
|
||||
|
||||
<div class="tab-pane fade" id="eqslcard" role="tabpanel" aria-labelledby="table-tab">
|
||||
<?php
|
||||
if ($row->eqsl_image_file != null) {
|
||||
echo '<img class="d-block" src="' . base_url() . '/images/eqsl_card_images/' . $row->eqsl_image_file .'" alt="eQSL picture">';
|
||||
}
|
||||
$CI =& get_instance();
|
||||
$CI->load->model('Eqsl_images');
|
||||
$eqlpath = $CI->Eqsl_images->get_imagePath();
|
||||
if ($row->eqsl_image_file != null) {
|
||||
echo '<img class="d-block" src="' . base_url() . '/'. $eqlpath .'/' . $row->eqsl_image_file .'" alt="eQSL picture">';
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
<?php
|
||||
|
||||
Reference in New Issue
Block a user