我有一个来自UberGallery的UberGallery.php文件,我正在使用它。
每个图像弹出窗口都会显示图片名称(例如 4488826 6f061c99ec b d),该名称取自于UberGallery.php。
现在我想要在每个图像弹出窗口底部展示图像名称(4488826 6f061c99ec b d)和电子邮件地址(aaa@gmail.com)。 如果我在上面的file_title的
我应该如何将姓名和电子邮件传递给上述的 file_title 以获得所需结果?还是有其他方法可以做到这一点吗?
请帮我找出解决方案。
每个图像弹出窗口都会显示图片名称(例如 4488826 6f061c99ec b d),该名称取自于UberGallery.php。
// Loop through array and add additional info
foreach ($dirArray as $key => $image) {
// Get files relative path
$relativePath = $this->_rImgDir . '/' . $key;
$galleryArray['images'][htmlentities(pathinfo($image['real_path'], PATHINFO_BASENAME))] = array(
'file_title' => str_replace('_', ' ', pathinfo($image['real_path'], PATHINFO_FILENAME)),
'file_path' => htmlentities($relativePath),
'thumb_path' => $this->_createThumbnail($image['real_path'])
);
}
file_title 在上面的代码中影响了标题的更改。在 defaultGallery.php 中,图像显示如下:
<?php if (!empty($images) && $stats['total_images'] > 0): ?>
<ul id="galleryList" class="clearfix">
<?php foreach ($images as $image): ?>
<li><a href="<?php echo html_entity_decode($image['file_path']); ?>" title="<?php echo $image['file_title']; ?>" rel="<?php echo $relText; ?>"><img src="<?php echo $image['thumb_path']; ?>" alt="<?php echo $image['file_title']; ?>"/></a></li>
<?php endforeach; ?>
</ul>
<?php else: ?>
<p>No images found.</p>
<?php endif; ?>
现在我想要在每个图像弹出窗口底部展示图像名称(4488826 6f061c99ec b d)和电子邮件地址(aaa@gmail.com)。 如果我在上面的file_title的
str_replace
函数中更改以从csv文件中获取电子邮件地址,则什么也不会显示。gallery.csv
有两个字段,如4488826 6f061c99ec b d aaa@gmail.com
。我想将这两个值传递给file_title,以便它们出现在图像弹出窗口中。$file_handle = fopen("gallery.csv", "r");
while (!feof($file_handle)) {
$lines_of_text[] = fgetcsv($file_handle, 1024);
}
fclose($file_handle);
// Loop through array and add additional info
foreach ($dirArray as $key => $image) {
// Get files relative path
$relativePath = $this->_rImgDir . '/' . $key;
$galleryArray['images'][htmlentities(pathinfo($image['real_path'], PATHINFO_BASENAME))] = array(
'file_title' => str_replace('_', $lines_of_text[1], pathinfo($image['real_path'], PATHINFO_FILENAME)),
'file_path' => htmlentities($relativePath),
'thumb_path' => $this->_createThumbnail($image['real_path'])
);
}
我应该如何将姓名和电子邮件传递给上述的 file_title 以获得所需结果?还是有其他方法可以做到这一点吗?
请帮我找出解决方案。