Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/264.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 使用jquery显示更大版本的缩略图图像_Php_Jquery_Html - Fatal编程技术网

Php 使用jquery显示更大版本的缩略图图像

Php 使用jquery显示更大版本的缩略图图像,php,jquery,html,Php,Jquery,Html,我正试图让我的(JQuery)代码显示我的缩略图图像的更大版本。 现在我有了这段代码,它只以“全尺寸”显示缩略图: $(“.gallerythumbnail”)。单击(函数(){ $(“.showmagelightdown、.showmagecontainer、.closeimage”).fadeIn(300); 变量img=$(' 我尝试了不同的方法,包括: $(".gallerythumbnail").click(function() { $(".showimagelightdown

我正试图让我的(JQuery)代码显示我的缩略图图像的更大版本。 现在我有了这段代码,它只以“全尺寸”显示缩略图:

$(“.gallerythumbnail”)。单击(函数(){
$(“.showmagelightdown、.showmagecontainer、.closeimage”).fadeIn(300);
变量img=$('
我尝试了不同的方法,包括:

$(".gallerythumbnail").click(function() {
    $(".showimagelightdown, .showimagecontainer, .closeimage").fadeIn(300);
    var img = $('<img />', { src : 'f'+this.src });
    $('.showimagecontainer').html(img).show();
});
$(“.gallerythumbnail”)。单击(函数(){
$(“.showmagelightdown、.showmagecontainer、.closeimage”).fadeIn(300);
变量img=$('
在上面,我尝试在图像路径中添加一个“f”,这将是缩略图的完整版本,但运气不好。
那么,有没有可能在点击图像的路径上添加一些内容?或者有没有更聪明的方法

至于html,我有一个循环(PHP)运行在一个文件夹中的所有图像上,并将它们打印出来,如下所示:

print "<td><a href='#'><img src='".$picsarray[$picsfrom]."' class='gallerythumbnail'></a></td>";
print”“;

您正在将“f”添加到完整路径的开头,而不是文件名的开头

因此,如果您有以下路径:

http://mydomain.com/galleries/gallery2/4886193_460s.jpg
您正在这样做:

fhttp://mydomain.com/galleries/gallery2/4886193_460s.jpg
试试这个:

$(".gallerythumbnail").click(function() {
        $(".showimagelightdown, .showimagecontainer, .closeimage").fadeIn(300);
        var path = this.src.replace(/[^\/]*$/,'');
        var filename = this.src.replace(/^.*[\\\/]/, '')

        var img = $('<img />', { src : path + 'f' + filename});     
        $('.showimagecontainer').html(img).show();
    });

对于较大的版本,您有不同的图像吗?您也可以显示一些HTML。Hanlet:是的,对于较大的版本,我有不同的图像。putvande:我已经添加了htmlRetsam的相关部分:放大/增强是什么意思?什么是
$picsarray[$picsfrom]
?如果在它前面添加
f
,会是什么?
$(".gallerythumbnail").click(function() {
        $(".showimagelightdown, .showimagecontainer, .closeimage").fadeIn(300);
        var path = this.src.replace(/[^\/]*$/,'');
        var filename = this.src.replace(/^.*[\\\/]/, '')

        var img = $('<img />', { src : path + 'f' + filename});     
        $('.showimagecontainer').html(img).show();
    });
http://mydomain.com/galleries/gallery2/f4886193_460s.jpg