dongyisa6254 2014-08-30 00:32
浏览 215
已采纳

Joomla - 发布图片

I am trying to post pictures in a joomla page. I am completely new in php and joomla.

This is what I have in a joomla page:

<h1>Welcome to my home page!</h1>
<p>Some text.</p>
<p>Some more text.</p>
<p><img src="images/test.php?id=8" alt="powered by" />
</p>
<p>Done!</p>

this is test.php:

<?php

$link=...... //connection to database
if(isset($_GET['id']))
{
    $id = mysql_real_escape_string($_GET['id']);
    $query=... 
    $result=mysqli_query($link,$query); 
    while($row=mysqli_fetch_array($result)) { 
        $imageData = $row['photo'];
    }
    header("content-type: image/png");
    echo $imageData;
}
?>

This is just for a simple 1 photo print, I eventually want to print multiple photos, and have like a slideshow.

Is this possible using joomla?

I also tried several other ways, but I had no luck. Is it possible to have ?

I just need a way through loop through images that are in a database, and print them out. Is there a good approach to this than what I am taking? Do I have to install plugins?

  • 写回答

1条回答 默认 最新

  • doujia1939 2014-08-30 01:03
    关注

    This is a completely wrong approach.

    You have to develop a custom module to handle your slideshow task. You could start here.

    As for your current code you have to convert it to:

    <?php
    
       $db = JFactory::getDbo();
       $query = $db->getQuery(true)
                ->select($db->quoteName('id'))
                ->from($db->quoteName('#__helloworld'))
                ->where('id = '. $db->Quote($params));
       $db->setQuery($query);
       $results = $db->loadObjectList();
    
       print_r($results);
    
    ?>
    

    Please check the full list of joomla database functions.

    This part will help you how you could display your results.

    Good Luck!

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 如何让企业微信机器人实现消息汇总整合
  • ¥50 关于#ui#的问题:做yolov8的ui界面出现的问题
  • ¥15 如何用Python爬取各高校教师公开的教育和工作经历
  • ¥15 TLE9879QXA40 电机驱动
  • ¥20 对于工程问题的非线性数学模型进行线性化
  • ¥15 Mirare PLUS 进行密钥认证?(详解)
  • ¥15 物体双站RCS和其组成阵列后的双站RCS关系验证
  • ¥20 想用ollama做一个自己的AI数据库
  • ¥15 关于qualoth编辑及缝合服装领子的问题解决方案探寻
  • ¥15 请问怎么才能复现这样的图呀