Typo3 サイトに PHP スクリプトを含めました。この PHP スクリプトは、 imageflow-sliderのベースとして自動的に取得される img タグを生成します。
イメージフロー ファイルは、フォルダー /fileadmin/teamtemplate にあります。/fileadmin/teamtemplate/images 内の画像。
imageflow.js には、次のパラメーターがあります。
this.defaults =
{
imagePath: '', /* Path to the images relative to the reflect_.php script */
reflectPath: 'fileadmin/teamtemplate/', /* Path to the reflect_.php script */
htmlファイルの出力には、次のものがあります。
img src="./images/1317986502.png" ongdesc="" width="380" height="253" alt="" />
(申し訳ありませんが、HTMLコードを投稿する方法がわかりませんでした。)Imageflowは次のパスを作成します。これは機能しています:
fileadmin/teamtemplate/reflect3.php?img=./images/1317986502.png
問題は次のとおりです。
(./images) にアクセスできるため、reflect3.php のパスは正しいです。
-reflect3.php
-images/
--1317986502.png
Imageflow は通常、html img src タグで指定された URL を取ります。Reflect3.php は画像にアクセスできるようになりましたが、html コードのパスが間違っています。
HTML では間違っていますが、reflect3.php がファイルを見つけるので機能します
img src="./images/1317986502.png" ongdesc="" width="380" height="253" alt="" />
HTML では正しいが、reflect3.php がファイルを見つけられない
img src="./fileadmin/teamtemplate/images/1317986502.png" ongdesc="" width="380" height="253" alt="" />
imageflow.js のコードの誤り
version = (my.reflectionPNG) ? '3' : '2';
src = my.imagePath+node.getAttribute('src',2);
src = my.reflectPath+'reflect'+version+'.php?img='+src+my.reflectionGET;
node.setAttribute('src',src);
my.reflectionGET は、最後の 1317986502.png のみを取得するように文字列を分解する必要があります。
作業ソリューション:
/* Add 'reflect.php?img=' */
if(my.reflections === true)
{
version = (my.reflectionPNG) ? '3' : '2';
if(my.imagePath === "") {
src = my.imagePath+node.getAttribute('src',2);
src = my.reflectPath+'reflect'+version+'.php?img='+src+my.reflectionGET;
} else {
var imagePath = node.getAttribute('src',2);
var slash = "/";
var lastOccurence = imagePath.lastIndexOf(slash);
var withoutPath = imagePath.substring(lastOccurence, imagePath.length);
src = my.imagePath+withoutPath;
src = my.reflectPath+'reflect'+version+'.php?img='+src+my.reflectionGET;
}
node.setAttribute('src',src);
}