php上传图片获取路径
‘壹’ php fckeditor 上传的图片默认的那个userfiles文件夹在哪
config.php 里面的
然后
$Config['Enabled'] = true ; //先设为true,
$Config['UserFilesPath'] = '/userfile/' ;
这个路径就是相对你程序(网站根目录的路径),你自己建个目录也可以,如果没有建,系统会自动建的。
比如/userfile/就是根目录下userfile文件夹。
‘贰’ php读取图片的路径
你的代码是遍历$dir文件夹下面的文件,然后输出成<img src=""/>,访问服务器上的图片一般是网址+具体路径,例如:localhost/public/logo.jpg,是指访问网址根目录下的public/logo.jpg文件,对应你这里的就是htdocs/public/logo.jpg
图片的显示大小可以设置img的width和heigth属性,位置可以设置相应的css值,例如<img src="/public/logo.jpg" width="100px" heigth="100px" style="display:block;margin:0 auto">
‘叁’ PHP+Mysql要如何做才能上传图片后在数据库中显示图片路径,要能用的!
在上传代码中首先获取上传文件图片的文件名$filename,然后insert的时候将获取的文件名insert到adminphoto中
mysql_query("insert into admindata (adminphoto) values ('images/".$filename."')")
显示的时候
<img src="<?=$AdminPhoto?>">" width="111" height="144">
$AdminPhoto为查询到你数据库的图片路径
$AdminPhoto替换成$rs->AdminPhoto
‘肆’ PHP怎么上传图片路径,怎么获取图片路径
$filePath 应该是上传的临时文件吧,然后将$filePath,这个文件移动到 $uploadPath,$uploadPath,应该就 你已经上传的图片的路径!包含图片文件的名称。
‘伍’ php中如何调用数据库中的图片并且显示到页面
php是采用二进制形式存储图片及读取显示的,首先通过代码创建数据表,然后上传图片服务器再通过浏览器显示,具体编程代码举例:
1、首先需要创建数据表,具体代码如下图所示。
‘陆’ php thinkphp 怎么获取上传图片的路径
$info = $upload->upload ();
$data ['表单名称'] = $info ['表单名称'] ['savepath'] . $info ['表单名称'] ['savename'];
‘柒’ 用PHP获取链接及图片路径的方法
<?php
$str="Thisisatest.Thisisatest.Thisisa<ahref=http://link1.com><imgsrc=http://img1.jpg/></a>test.Thisisatest.Thisisatest. ".
"Thisisatest.Thisisatest.<ahref=http://link2.com><imgsrc=http://img2.jpg/></a>Thisisatest.Thisisatest.Thisisatest. ".
"<ahref=http://link3.com><imgsrc=http://img3.jpg/></a>";
$regex='/<as+href=(.*)s*><imgs+src=(.*)s*/></a>/';
$output=array();
if(preg_match_all($regex,$str,$matches)!==false){
if(isset($matches[1])&&isset($matches[2])){
$links=$matches[1];
$imgs=$matches[2];
foreach($linksas$key=>$link){
$img=isset($imgs[$key])?$imgs[$key]:'';
$output[]="<ahref="{$link}"><imgsrc="{$img}"/></a>";
}
}
}
var_mp($output);