mysql - 图片如何伪本地?
PHP中文网
PHP中文网 2017-04-17 15:43:19
0
3
457

1.图片如何伪本地,应用中心的说明看过了,没有用

2.

将 RewriteEngine 模式打开

RewriteEngine On
RewriteBase /
RewriteRule ^(.*)$ 七牛url/forum/7niu/$1
3.使用上面一段代码后,确实可以在列表显示,但图片显示不出来
4.显示出来的是这样的:
5.还试过了nginx服务器增
加rewrite规则
rewrite data/attachment/forum/7niu/^(.*)$ http://xxxxxx/forum/7niu/$1 break;
可没有用,和上面的效果一样。

PHP中文网
PHP中文网

认证高级PHP讲师

reply all(3)
Ty80

URL rewriting + PHP code correction, write URL rewriting rules

<IfModule mod_rewrite.c>
    RewriteEngine On
    # 将 host/img/下的链接全部处理
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^(.*+)$ img/index.php?img= [L]
</IfModule>

Use PHP code to process images

<?php
    // do something...
    echo file($_GET['img']);

If you’re not serious, you can also add your own website’s watermark to the picture


At LZ’s request, the following demo:

<?php
if (isset($_GET['img'])) {
     header("Content-type: image/png");
     $im=imagecreatefrompng($_GET['img']);
     $text_color = imagecolorallocate($im, 255, 0, 0);
     imagestring($im, 16, imagesx($im)-16*13, imagesy($im)-16,  "from atd3.cn", $text_color);
     imagepng($im);
     imagedestroy($im);
 } else {
    echo 'No Image';
}

Original image

Insert URL and watermark

Then, the code was originally promised to be given on Sunday,,, haha, there are too many things at school. . .


Learning has no field, just learn it to the end

小葫芦

I am using dz3.2gbk
Maybe due to space reasons, I should use web.config
Forgive me for being stupid, I have studied the above method for a long time but have not studied how to use it
Where is [Write URL Rewriting Rules] Write?
【PHP code processing pictures】Where to copy this code?
It seems that the Qiniu Cloud address can be called. How can I call it? There is no tutorial...

大家讲道理

rewrite data/attachment/forum/7niu/^(.*)$ http://xxxxxx/forum/7niu/$1 break;

This way of writing should be wrong.

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!