:JoomGallery.net |私は私の芸術の学生のためjoomgalleryため、このシンプルなイメージスライダーを使用したい画像の順序ASC
https://github.com/danielhpavey/joomgallery-slider
唯一の問題は順序です。どのように私はファイル名ではなく、IDで注文する昇順の画像を取得するのですか?
おかげピーター
<?php
class images
{
public function __construct()
{
$file = JPATH_ROOT. '/components/com_joomgallery/interface.php';
if(!file_exists($file)){
JError::raiseError(500, 'JoomGallery seems not to be installed');
} else {
require_once $file;
$this ->interface = new JoomInterface();
}
}
public function getFirstImage()
{
$images = $this ->talkToJoomgallery();
return $images[0];
\t
}
public function getImages()
{
$images = $this ->talkToJoomgallery();
return $images;
}
public function talkToJoomgallery()
{
$images = $this ->interface ->getPicsByCategory($this ->categoryid);
$imagepath = $this ->joomgalleryImagePath();
$theimages = array();
$c = 0;
foreach ($images as $i){
$theimages[$c]= array(
'imgpath' => JURI::base() . $imagepath . $i->catpath . '/' . $i->imgfilename
,'imgtitle' => $i->imgtitle
,'imgtext' => $i->imgtext
);
$C++;
}
shuffle($theimages);
return $theimages;
}
private function joomgalleryImagePath()
{
return $this ->interface ->getJConfig('jg_pathoriginalimages');
}
public function __set($property, $value){
$this->$property = $value;
}
}
お返事ありがとうございました。多分私の質問はちょっと混乱していたかもしれません。私はすでにシャッフル($ theimages)が画像をファイル名でシャッフルすることに気付きました。そこで私はjoomgallery自体の注文を確実に得るために、 "idによる画像の昇順"の解決策を求めました。私が必要とするのは、スライダーがjoomgalleryの画像/画像の順番を取ることです。ドラッグアンドドロップで順序を変更すると、スライドショーの順序が変わります。ありがとうpeter –
@ PeterReillもう一度答えを確認してください、私はあなたの要件に従ってそれを変更しました。 –
この素晴らしいコードをありがとう。できます! –