Galleria Dynamic Images issue
I am trying to get Galleria to display a set of dynamic images - by dynamic I mean the images are created at runtime by a PHP script. The PHP script in question actually takes two images (one photograph and the other I want to use as the watermark to protect the image) and merges them together.
So, my image link within the Galleria div has moved from this:
<a href="images/upload/1024_<?php echo $row_rstImages['image_filename']; ?>"> <img title="<?php echo $row_rstImages['image_title']; ?>"
alt="<?php echo $row_rstImages['image_description']; ?>"
src="images/upload/100_<?php echo $row_rstImages['image_filename']; ?>"> </a>
which works fine, to this:
<a href="inc_create_image_wm_gallery.php?s=1024&i=<?php echo $row_rstImages['image_id']; ?>"> <img title="<?php echo $row_rstImages['image_title']; ?>"
alt="<?php echo $row_rstImages['image_description']; ?>"
src="images/upload/100_<?php echo $row_rstImage开发者_JAVA百科s['image_filename']; ?>"> </a>
As you will probably determine, the script 'inc_create_image_wm_gallery.php' takes two parameters, the output size (s) and the image id from the associated entry in the database (i).
The result of the second version above is that Galleria instead displays the thumbnail version (100 pixel wide version), not the 1024 pixel version I want.
The PHP script has the appropriate headers set (header('content-type: image/jpeg');) and when I try the script alone in a browser with appropriate parameters in the URL it outputs the watermarked image exactly as I would expect.
Any ideas why it might be affecting Galleria so adversely?
That is because Galleria detects file endings in the href. To force Galleria to accept any href as image file (including .php suffixes), try this:
$('#galleria').galleria({
dataConfig: function(img) {
return {
image: $(img).parent().attr('href')
}
}
});
精彩评论