【问题标题】:How to add watermark image in all pages using codeigniter?如何使用codeigniter在所有页面中添加水印图像?
【发布时间】:2019-03-13 19:13:05
【问题描述】:

我想为所有应该固定在中心的 php 页面添加水印图像。

<link rel="stylesheet" type="text/css" href="<?php echo base_url(); ?>assets/css/wstyle.css">

wstyle.css 文件

body {
   background-image: url('../images/anna.png');
   background-size: auto;   
}

图片未加载到我的页面中。如何解决?有什么替代方法可用吗?

【问题讨论】:

  • 嗨@anbesivam,欢迎来到 StackOverflow。这可能是由许多问题引起的。尝试从保持简单开始;在您的 ˋˋ 元素的样式属性中添加 ˋbackgroundˋ 样式并验证它是否有效。然后逐步向上移动,将其移动到内联样式表,最后移动到外部样式表文件。编码愉快!
  • 我认为你需要指定宽度

标签: php html codeigniter watermark alternate


【解决方案1】:

试试这个..

<link rel="stylesheet" type="text/css" href="<?php echo base_url(); ?>assets/css/wstyle.css">

wstyle.css

body {
background: url(../images/anna.png) no-repeat;
background-position: 50% 50%;
background-size: auto;}

适用于所有页面
在视图中创建新文件 header.php 将该代码放入此文件中

<link rel="stylesheet" type="text/css" href="<?php echo base_url(); ?>assets/css/wstyle.css">

在所有控制器中调用 header.php

<?php 
if (!defined('BASEPATH')) exit('No direct script access allowed');
class Home extends CI_Controller {

function __construct() {
    parent::__construct();
}

function index() {
    $this->load->view('header');
    $this->load->view('home');
}
}

?>

【讨论】:

  • 工作出色。但图像显示原始文件。无法在图片管理器中设置亮度。如何在css中将图像设置为水印
猜你喜欢
  • 2022-01-16
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2011-05-03
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多