質問 > 管理機能 > 外部パスで画像を登録したいのですが |
管理機能
スレッド表示 | 古いものから | 前のトピック | 次のトピック | 下へ |
投稿者 | スレッド |
---|---|
stella |
投稿日時: 2010/9/10 15:34
対応状況: −−−
|
新米 登録日: 2010/9/3 居住地: 投稿: 6 |
Re: 外部パスで画像を登録したいのですが AMUAMU様、seasoft様、ご回答ありがとうございます。
>AMUAMU様 初心者には難しそうですね。 >seasoft様 2箇所目の赤文字ですが、<!--{else}-->〜<!--{/if}-->内は拡大画像のためのソースだと考え、前回教えて頂いたソースをそのまま貼り付けてみました。 そんな単純にいくほど甘くはなかったようですね。。。 拡大画像が表示できるよういろいろと奮闘してみたのですが、どうにもうまくいかないため、思考をちょっと変えて詳細ページ内にスワップイメージを設ける事に挑戦してみました。 が、、、 Dreamweaverを使用してtpl内をいじってみましたが結果うまくいきません。。。 <!--▼CONTENTS--> <script type="text/javascript"> <!-- function MM_preloadImages() { //v3.0 var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array(); var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++) if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}} } function MM_swapImgRestore() { //v3.0 var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc; } function MM_findObj(n, d) { //v4.01 var p,i,x; if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) { d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);} if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n]; for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document); if(!x && d.getElementById) x=d.getElementById(n); return x; } function MM_swapImage() { //v3.0 var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3) if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];} } //--> </script> <body onload="MM_preloadImages('<img src="<!--{$arrProduct.sub_image1|escape}-->" width="80px" height="80px" alt="<!--{$arrProduct.name|escape}-->" class="picture" />','<img src="<!--{$arrProduct.sub_image2|escape}-->" width="80px" height="80px" alt="<!--{$arrProduct.name|escape}-->" class="picture" />','<img src="<!--{$arrProduct.sub_image3|escape}-->" width="80px" height="80px" alt="<!--{$arrProduct.name|escape}-->" class="picture" />','<img src="<!--{$arrProduct.sub_image4|escape}-->" width="80px" height="80px" alt="<!--{$arrProduct.name|escape}-->" class="picture" />','<img src="<!--{$arrProduct.sub_image5|escape}-->" width="80px" height="80px" alt="<!--{$arrProduct.name|escape}-->" class="picture" />')"> ・・・・省略・・・・ <!--★画像★--> <p> <img src="<!--{$arrProduct.main_large_image|escape}-->" alt="<!--{$arrProduct.name|escape}-->" name="swap_img" width="280px" height="280px" class="picture" id="swap_img" /> </p> <p> ▼下の画像をクリックすると上に大きく表示されます▼ </p> <table> <tr> <td width="88"><img src="<!--{$arrProduct.sub_image1|escape}-->" alt="<!--{$arrProduct.name|escape}-->" width="80px" height="80px" class="picture" onclick="MM_swapImage('swap_img','','<img src=!--{$arrProduct.sub_image1|escape}-->" width="80px" height="80px" alt="<!--{$arrProduct.name|escape}-->" class="picture" />',1);MM_swapImgRestore()" /></td> <td width="88"><img src="<!--{$arrProduct.sub_image2|escape}-->" alt="<!--{$arrProduct.name|escape}-->" width="80px" height="80px" class="picture" onclick="MM_swapImage('swap_img','','<img src="<!--{$arrProduct.sub_image2|escape}-->" width="80px" height="80px" alt="<!--{$arrProduct.name|escape}-->" class="picture" />',1)" /></td> <td width="89"><img src="<!--{$arrProduct.sub_image3|escape}-->" alt="<!--{$arrProduct.name|escape}-->" width="80px" height="80px" class="picture" onclick="MM_swapImage('swap_img','','<img src="<!--{$arrProduct.sub_image3|escape}-->" width="80px" height="80px" alt="<!--{$arrProduct.name|escape}-->" class="picture" />',1)" /></td> <td width="89"><img src="<!--{$arrProduct.sub_image4|escape}-->" alt="<!--{$arrProduct.name|escape}-->" width="80px" height="80px" class="picture" onclick="MM_swapImage('swap_img','','<img src="<!--{$arrProduct.sub_image4|escape}-->" width="80px" height="80px" alt="<!--{$arrProduct.name|escape}-->" class="picture" />',1)" /></td> <td width="89"><img src="<!--{$arrProduct.sub_image5|escape}-->" alt="<!--{$arrProduct.name|escape}-->" width="80px" height="80px" class="picture" onclick="MM_swapImage('swap_img','','<img src="<!--{$arrProduct.sub_image5|escape}-->" width="80px" height="80px" alt="<!--{$arrProduct.name|escape}-->" class="picture" />',1)" /></td> </tr> </table> 懲りず、seasoft様に教えて頂いたソースを乱用してます。。。 画像は6枚ともちゃんと表示されるのですが、画像をクリックするとスワップ先の画像が消え <!--{$arrProduct.name|escape}--> という表示がでてきます。 変化自体はするので全く機能してないわけではなさそうなのですが、うまくいきません。 よく見てみると拡大画像のために(恐らく)記述されていたjsが<!--▼CONTENTS-->前に記されていたのに対して、今回のスワップのためのjsは<!--▼CONTENTS-->の直下に記されていました。 一応<!--▼CONTENTS-->前に変更してみましたが変化ありませんでした。 あと、jsの記述の後に<body onload>というbodyタグが記されているのですが、tpl内で使用できるのでしょうか。。 素人目から見て以上の原因候補が見てとれました。 もしスワップイメージをEC-CUBEで使用した経験がある方、解決方法がおわかりになる方がいらっしゃれば是非お知恵を貸して下さい。 乱文失礼いたしました。 |
seasoft |
投稿日時: 2010/9/8 2:51
対応状況: −−−
|
神 登録日: 2008/6/4 居住地: 投稿: 7367 |
Re: 外部パスで画像を登録したいのですが コミュニティ版なら、サクッとカスタマイズできるのですが、正式版はこの辺り面倒ですね・・・
あと、カスタマイズ済みソースの後半の赤色部分は、ソース的に意図が、やや不明な印象です。
|
AMUAMU |
投稿日時: 2010/9/8 0:51
対応状況: −−−
|
神 登録日: 2009/5/2 居住地: 東京都 投稿: 2712 |
Re: 外部パスで画像を登録したいのですが 一覧画面で拡大イメージを表示するにはPHP側の修正が必要です。標準では情報は入っていませんのでテンプレート修正だけでは無理だと思います。
拡大画像を見る画面(LC_PageProducts_DetailImage)も今回されようとしている仕様変更に合わせて修正が必要だと思います。
|
stella |
投稿日時: 2010/9/7 22:34
対応状況: −−−
|
新米 登録日: 2010/9/3 居住地: 投稿: 6 |
Re: 外部パスで画像を登録したいのですが seasoft様、ご回答ありがとうございます。
ご指示通りに変更すると詳細ページだけでなく一覧ページの画像も呼び出すことに成功しました。 本当にありがとうございました。 しかし何故か拡大画像だけはブラウザは開くものの、表示されるのは商品名だけで画像のほうは表示されませんでした。 変更箇所が足りない若しくは間違いがあるのでしょうか。。。 よろしければ、ご指摘頂けたら幸いです。 ※変更箇所は赤色で書いています※ <!--{assign var=key value="main_image"}--> <!--{if $arrProduct.main_large_image != ""}--> <!--★画像★--> <a href="java script:void(win01('./detail_image.php?product_id=<!--{$arrProduct.product_id}-->ℑ=main_large_image<!--{if $smarty.get.admin == 'on'}-->&admin=on<!--{/if}-->','detail_image','<!--{$arrFile.main_large_image.width+60}-->', '<!--{$arrFile.main_large_image.height+80}-->'))"> <img src="<!--{$arrProduct.main_image|escape}-->" width="<!--{$arrFile[$key].width}-->" height="<!--{$arrFile[$key].height}-->" alt="<!--{$arrProduct.name|escape}-->" class="picture" /></a> <p> <!--★拡大する★--> <a href="java script:void(win01('./detail_image.php?product_id=<!--{$arrProduct.product_id}-->ℑ=main_large_image<!--{if $smarty.get.admin == 'on'}-->&admin=on<!--{/if}-->','detail_image','<!--{$arrFile.main_large_image.width+60}-->', '<!--{$arrFile.main_large_image.height+80}-->'))" onmouseover="chgImg('<!--{$TPL_DIR}-->img/products/b_expansion_on.gif','expansion01');" onMouseOut="chgImg('<!--{$TPL_DIR}-->img/products/b_expansion.gif','expansion01');"> <img src="<!--{$TPL_DIR}-->img/products/b_expansion.gif" width="85" height="13" alt="画像を拡大する" name="expansion01" id="expansion01" /></a> </p> <!--{else}--> <img src="<!--{$arrProduct.main_large_image|escape}-->" width="<!--{$arrFile[$key].width}-->" height="<!--{$arrFile[$key].height}-->" alt="<!--{$arrProduct.name|escape}-->" class="picture" /> <!--{/if}--> おわかりになる方がいらっしゃったら是非コメント宜しくお願い致します。 乱文失礼しました。 |
seasoft |
投稿日時: 2010/9/5 17:42
対応状況: −−−
|
神 登録日: 2008/6/4 居住地: 投稿: 7367 |
Re: 外部パスで画像を登録したいのですが <!--{$arrFile[$key].filepath}--> を <!--{$arrProduct.****|escape}--> に変更してみては?
※ **** は列名
|
stella |
投稿日時: 2010/9/5 16:01
対応状況: −−−
|
新米 登録日: 2010/9/3 居住地: 投稿: 6 |
Re: 外部パスで画像を登録したいのですが LC_Page_Admin_Products_UploadCSV.phpを変更後、商品として読み込みが成功しました。
が、画像が一切表示されませんでした。 ブラウザからソース表示して確認してみると、画像リンクの箇所がsrc=/eccube/upload/save_image/http: //●●●●●●●.com/item_image/2880000107545/1/m.jpgとなっており、おそらくどこかの設定で自動的に /eccube/upload/save_image/から画像を引っ張ってくるようになっているんだと思うのですが。。。 詳細ページの仕組みはどうなっているんだろうと、/httpdocs/eccube/data/Smarty/templates/default/detail.tplを開いて確認してはみたのですが、PHP初心者のため構造が理解できませんでした。 おそらく、detail.tpl中の<img src="<!--{$arrFile[$key].filepath}-->" width="<!--{$arrFile[$key].width}-->" height="<!--{$arrFile[$key].height}-->" alt="<!--{$arrProduct.name|escape}-->" class="picture" />という記述が関係してるのではないかとは思うのですが。。。 私としましては、<img src="外部パスのURL">となるようにしたいと思っております。 よろしければどなたかお知恵をかして頂ければ幸いです。 乱文失礼いたしました。 |
stella |
投稿日時: 2010/9/4 14:35
対応状況: −−−
|
新米 登録日: 2010/9/3 居住地: 投稿: 6 |
Re: 外部パスで画像を登録したいのですが AMUAMU様、55eccube様、seasoft様、早速の回答ありがとうございます。
皆さんのご指摘通り、PHPの書き込みのミスがあったようです。 こんな質問にわざわざ時間をとっていただいたなんて、、、本当に申し訳ありませんでした。 |
seasoft |
投稿日時: 2010/9/4 11:20
対応状況: −−−
|
神 登録日: 2008/6/4 居住地: 投稿: 7367 |
Re: 外部パスで画像を登録したいのですが > 画面が真っ白になってしまい登録できませんでした。
参考になると良いのですが・・・ http://seasoft.jp1.cx/ec/tips/error#%E7%94%BB%E9%9D%A2%E3%81%8C%E7%9C%9F%E3%81%A3%E7%99%BD
|
55eccube |
投稿日時: 2010/9/3 18:01
対応状況: −−−
|
長老 登録日: 2010/8/18 居住地: 東京 投稿: 222 |
Re: 外部パスで画像を登録したいのですが AMUAMUさんの仰るとおり、まずはログを参照してみるのがよろしいと思います。
セミコロンやダブルクォーテーション、カンマなどが適切に記述されているか、注意深くご確認ください。 |
AMUAMU |
投稿日時: 2010/9/3 16:58
対応状況: −−−
|
神 登録日: 2009/5/2 居住地: 東京都 投稿: 2712 |
Re: 外部パスで画像を登録したいのですが 画面が真っ白と言うことは、何かしら間違った編集をしてPHPのエラーが起きていると思われます。
まずは編集内容がPHPのルールにあった記述がされているか確認をされるのがいいと思います。 また、PHPのエラーログが確認出来る環境の場合は確認されれば、間違った内容のヒントが出ています。エラーログについてはプロバイダや適切なPHPの解説サイトなどを確認されると良いと思います。
|
« 1 (2) 3 » |
スレッド表示 | 古いものから | 前のトピック | 次のトピック | トップ |