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 求差集那个函数有问题,有无佬可以解决
  • ¥15 【提问】基于Invest的水源涵养
  • ¥20 微信网友居然可以通过vx号找到我绑的手机号
  • ¥15 寻一个支付宝扫码远程授权登录的软件助手app
  • ¥15 解riccati方程组
  • ¥15 display:none;样式在嵌套结构中的已设置了display样式的元素上不起作用?
  • ¥15 使用rabbitMQ 消息队列作为url源进行多线程爬取时,总有几个url没有处理的问题。
  • ¥15 Ubuntu在安装序列比对软件STAR时出现报错如何解决
  • ¥50 树莓派安卓APK系统签名
  • ¥65 汇编语言除法溢出问题