Updated Fancybox library, added function to save images to cloudlog from eqsl

pull/427/head
Peter Goodhall 2020-03-01 18:08:17 +00:00
rodzic ecf999a943
commit c56aa4fa31
7 zmienionych plików z 87 dodań i 20 usunięć

Wyświetl plik

@ -569,30 +569,49 @@ class eqsl extends CI_Controller {
$this->load->view('interface_assets/footer');
}
function image($callsign, $mode, $band, $hour, $minute, $day, $month, $year) {
function image($id, $callsign, $mode, $band, $hour, $minute, $day, $month, $year) {
$this->load->library('eqsl_library');
$this->load->model('Eqsl_images');
$query = $this->user_model->get_by_id($this->session->userdata('user_id'));
$q = $query->row();
$username = $q->user_eqsl_name;
$password = $q->user_eqsl_password;
if($this->Eqsl_images->get_image($id) == "No Image") {
$query = $this->user_model->get_by_id($this->session->userdata('user_id'));
$q = $query->row();
$username = $q->user_eqsl_name;
$password = $q->user_eqsl_password;
$image_url = $this->eqsl_library->card_image($username, $password, $callsign, $band, $mode, $year, $month, $day, $hour, $minute);
$file = file_get_contents($image_url, true);
$image_url = $this->eqsl_library->card_image($username, $password, $callsign, $band, $mode, $year, $month, $day, $hour, $minute);
$file = file_get_contents($image_url, true);
$dom = new domDocument;
$dom->loadHTML($file);
$dom->preserveWhiteSpace = false;
$images = $dom->getElementsByTagName('img');
$dom = new domDocument;
$dom->loadHTML($file);
$dom->preserveWhiteSpace = false;
$images = $dom->getElementsByTagName('img');
foreach ($images as $image)
{
header('Content-Type: image/jpg');
readfile ("https://www.eqsl.cc".$image->getAttribute('src'));
foreach ($images as $image)
{
header('Content-Type: image/jpg');
readfile ("https://www.eqsl.cc".$image->getAttribute('src'));
$content = file_get_contents("https://www.eqsl.cc".$image->getAttribute('src'));
$filename = uniqid().'.jpg';
file_put_contents('images/eqsl_card_images/' . '/'.$filename, $content);
$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));
readfile($image_url);
}
}
function image_check($id) {
$this->load->model('Eqsl_images');
echo $this->Eqsl_images->get_image($id);
}
} // end class

Wyświetl plik

@ -0,0 +1,34 @@
<?php
class Eqsl_images extends CI_Model {
function __construct()
{
parent::__construct();
}
function get_image($qso_id) {
$this->db->where('qso_id', $qso_id);
$query = $this->db->get('eQSL_images');
$row = $query->row();
if(isset($row)) {
return $row->image_file;
} else {
return "No Image";
}
}
function save_image($qso_id, $image_name) {
$data = array(
'qso_id' => $qso_id,
'image_file' => $image_name,
);
$this->db->insert('eQSL_images', $data);
}
}
?>

Wyświetl plik

@ -2,7 +2,7 @@
<!-- jQuery first, then Popper.js, then Bootstrap JS -->
<script src="<?php echo base_url(); ?>assets/js/jquery-3.3.1.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.3/umd/popper.min.js" integrity="sha384-ZMP7rVo3mIykV+2+9J3UJ46jBk0WLaUAdn689aCwoqbBJiSnjAK/l8WvCWPIPm49" crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/gh/fancyapps/fancybox@3.5.7/dist/jquery.fancybox.min.js"></script>
<script src="<?php echo base_url(); ?>assets/js/jquery.fancybox.min.js"></script>
<script src="<?php echo base_url(); ?>assets/js/bootstrap.bundle.js"></script>
<script src="<?php echo base_url(); ?>assets/js/jquery.jclock.js"></script>
@ -234,7 +234,6 @@ $(document).on('keypress',function(e) {
<script type="text/javascript" src="<?php echo base_url();?>assets/js/leaflet/L.Maidenhead.js"></script>
<script type="text/javascript" src="<?php echo base_url();?>assets/js/leaflet/leafembed.js"></script>
<script type="text/javascript">
<?php if($qra == "set") { ?>
var q_lat = <?php echo $qra_lat; ?>;
var q_lng = <?php echo $qra_lng; ?>;

Wyświetl plik

@ -9,7 +9,7 @@
<link rel="stylesheet" href="<?php echo base_url(); ?>assets/css/bootstrap.min.css">
<link rel="stylesheet" href="<?php echo base_url(); ?>assets/fontawesome/css/all.css">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/fancyapps/fancybox@3.5.7/dist/jquery.fancybox.min.css" />
<link rel="stylesheet" href="<?php echo base_url(); ?>assets/css/jquery.fancybox.min.css" />
<link rel="stylesheet" href="<?php echo base_url(); ?>assets/css/general.css">

Wyświetl plik

@ -25,6 +25,7 @@
</tr>
<?php $i = 0; foreach ($results->result() as $row) { ?>
<?php echo '<tr class="tr'.($i & 1).'">'; ?>
<td><?php $timestamp = strtotime($row->COL_TIME_ON); echo date($this->config->item('qso_date_format'), $timestamp); ?></td>
<?php if(($this->config->item('use_auth') && ($this->session->userdata('user_type') >= 2)) || $this->config->item('use_auth') === FALSE || ($this->config->item('show_time'))) { ?>
@ -73,9 +74,9 @@
<span class="eqsl-<?php echo ($row->COL_EQSL_QSL_SENT=='Y')?'green':'red'?>">&#9650;</span>
<span class="eqsl-<?php echo ($row->COL_EQSL_QSL_RCVD=='Y')?'green':'red'?>">
<?php if($row->COL_EQSL_QSL_RCVD =='Y') { ?>
<a style="color: green" data-fancybox="gallery" href="<?php echo site_url("eqsl/image/".$row->COL_CALL."/".$row->COL_MODE."/".$row->COL_BAND."/".date('H', $timestamp)."/".date('i', $timestamp)."/".date('d', $timestamp)."/".date('m', $timestamp)."/".date('Y', $timestamp)); ?>">&#9660;</a>
<a style="color: green" data-fancybox="images" data-width="528" data-height="336" href="<?php echo site_url("eqsl/image/".$row->COL_PRIMARY_KEY."/".$row->COL_CALL."/".$row->COL_MODE."/".$row->COL_BAND."/".date('H', $timestamp)."/".date('i', $timestamp)."/".date('d', $timestamp)."/".date('m', $timestamp)."/".date('Y', $timestamp)); ?>">&#9660;</a>
<?php } else { ?>
<a style="color: green" data-fancybox="gallery" href="<?php echo site_url("eqsl/image/".$row->COL_CALL."/".$row->COL_MODE."/".$row->COL_BAND."/".date('H', $timestamp)."/".date('i', $timestamp)."/".date('d', $timestamp)."/".date('m', $timestamp)."/".date('Y', $timestamp)); ?>">&#9660;</a>
<a style="color: green" data-fancybox="images" data-width="528" data-height="336" href="<?php echo site_url("eqsl/image/".$row->COL_PRIMARY_KEY."/".$row->COL_CALL."/".$row->COL_MODE."/".$row->COL_BAND."/".date('H', $timestamp)."/".date('i', $timestamp)."/".date('d', $timestamp)."/".date('m', $timestamp)."/".date('Y', $timestamp)); ?>">&#9660;</a>
<?php } ?>
</span>
</td>

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long