网站资源下载时在资源中添加版权

        盗版猖獗,必须在资源上留下来源及版权,这样在别人转发、出售你的资源并且没经过编辑时,就会露出马脚。在文件打开后能查到我们留的相关信息。我是以wordpress做示例,大家看着改:

        1、伪静态

        需要将文件上传目录伪静态到新的PHP脚本进行数据处理:

# BEGIN WordPress
# 在“BEGIN WordPress”与“END WordPress”之间的指令(行)是
# 动态生成的,只应被WordPress过滤器修改。
# 任何对标记之间的指令的修改都会被覆盖。
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
RewriteBase /ziyuan/
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /ziyuan/index.php [L]
# 下载重定向,并在下载时处理一些事情
RewriteRule ^wp-content/uploads/(.*)?$ down/down.php?file=<pre class="wp-block-zibllblock-enlighter"><code class="gl" data-enlighter-language="generic" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group=""><?php
function download_document($filename,$path="",$mimetype)
{
 header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
 header("Content-Disposition: attachment; filename = $filename");
 header("Content-Length: " . filesize($pathto . $filename));
 header("Content-Type: $mimetype");
 echo file_get_contents($pathto . $filename)."\r\n"."680博客"."\r\n".time();
}

$filename = "H:/wwwroot/127.0.0.1/ziyuan/wp-content/uploads/".$_REQUEST['file'];
$type = mime_content_type($filename);
download_document($filename,$path="",$type);

?></code></pre>



<p><span style="font-size: 18px;">        3、文件路径</span></p>



<figure class="wp-block-image"><img loading="lazy" width="1280" height="639" src="https://680s.cc/wp-content/themes/zibll/img/thumbnail-lg.svg" data-src="https://680s.cc/wp-content/uploads//2022/04/202203181647579303748552.png" alt="网站资源下载时在资源中添加版权  第1张" class="wp-image-544 lazyload" title="网站资源下载时在资源中添加版权  第1张" data-srcset="https://680s.cc/wp-content/uploads//2022/04/202203181647579303748552.png 1280w, https://680s.cc/wp-content/uploads//2022/04/202203181647579303748552-300x150.png 300w, https://680s.cc/wp-content/uploads//2022/04/202203181647579303748552-1024x511.png 1024w, https://680s.cc/wp-content/uploads//2022/04/202203181647579303748552-768x383.png 768w" sizes="(max-width: 1280px) 100vw, 1280px" imgbox-id="swiper-imgbox-17878" imgbox-index="0"></figure>



<p><span style="font-size: 18px;"></span></p>



<p><span style="font-size: 18px;">        下载的图片查看留的信息示例:</span></p>



<figure class="wp-block-image"><img loading="lazy" width="1280" height="598" src="https://680s.cc/wp-content/themes/zibll/img/thumbnail-lg.svg" data-src="https://680s.cc/wp-content/uploads//2022/04/202203181647579461879265.png" alt="网站资源下载时在资源中添加版权  第2张" class="wp-image-545 lazyload" title="网站资源下载时在资源中添加版权  第2张" data-srcset="https://680s.cc/wp-content/uploads//2022/04/202203181647579461879265.png 1280w, https://680s.cc/wp-content/uploads//2022/04/202203181647579461879265-300x140.png 300w, https://680s.cc/wp-content/uploads//2022/04/202203181647579461879265-1024x478.png 1024w, https://680s.cc/wp-content/uploads//2022/04/202203181647579461879265-768x359.png 768w" sizes="(max-width: 1280px) 100vw, 1280px" imgbox-id="swiper-imgbox-17878" imgbox-index="1"></figure>



<p><span style="font-size: 18px;"></span></p>



<p><span style="font-size: 18px;">        图片是正常预览的,如果是文本,会在后面追加文本</span></p>



<figure class="wp-block-image"><img loading="lazy" width="1280" height="994" src="https://680s.cc/wp-content/themes/zibll/img/thumbnail-lg.svg" data-src="https://680s.cc/wp-content/uploads//2022/04/202203181647579502668752.png" alt="网站资源下载时在资源中添加版权  第3张" class="wp-image-546 lazyload" title="网站资源下载时在资源中添加版权  第3张" data-srcset="https://680s.cc/wp-content/uploads//2022/04/202203181647579502668752.png 1280w, https://680s.cc/wp-content/uploads//2022/04/202203181647579502668752-300x233.png 300w, https://680s.cc/wp-content/uploads//2022/04/202203181647579502668752-1024x795.png 1024w, https://680s.cc/wp-content/uploads//2022/04/202203181647579502668752-768x596.png 768w" sizes="(max-width: 1280px) 100vw, 1280px" imgbox-id="swiper-imgbox-17878" imgbox-index="2"></figure>



<p><span style="font-size: 18px;"></span></p>
© 版权声明
THE END
喜欢就支持一下吧
点赞0 分享
评论 抢沙发

请登录后发表评论

    暂无评论内容