你如何围绕主图像包装图像?

时间:2016-02-29 22:24:01

标签: php html mysql image layout

我知道如何做到这一点。我只是无法弄清楚如何让它工作。我很清楚我需要更新mysql。我稍晚会这样做。我无法弄清楚如何将照片放到主图像下面。

这是页码。

<?php
//$_GET['hideHeader'] = 1;
include "sql.php";



$car_id = intval($_GET['id']);
$x = mysql_query("select * from cars where id=" . $car_id);

$car = mysql_fetch_array($x, MYSQL_ASSOC);
if (!$car) die("This vehicle no longer exists.");

$title = (intval($car['year']) > 0 ? $car['year'] . " " : "") . $car['make'] . " " . $car['model'] . " " . $car['category'] . " at Morabito Motors";
$showSide = false;
include "header.php";
include "carpreview.php";

?><body id="box">



<div>
    <?php showCarPreview($car); ?>
</div>

<div style="float: right; margin: 0px 0px 20px 10px; width: 105px; overflow: auto;">

<?php

$x = mysql_query("select id,main from images where car_id=" . $car_id . " order by main desc,id desc");
while ($y = mysql_fetch_array($x, MYSQL_ASSOC))
{
    if (!isset($img)) $img = $y;
    ?>
    <div style="margin-bottom: 10px;">
        <!-- a href="viewpic.php?car_id=<?=$car_id?>&img_id=<?=$y['id']?>" -->
        <img src="/images/vehicles/<?=$car_id?>-<?=$y['id']?>t.jpg" onMouseOver="javascript:showImage(<?=$y['id']?>);">
        <!-- /a -->

    </div>
    <?php
}

?>

</div>

<?php

if (isset($img))
{
    ?>
    <img id="fullsize" src="images/vehicles/<?=$car_id?>-<?=$img['id']?>.jpg" width=640>
    <?php
}

?>

<script language="javascript">
function showImage(id)
{
    document.getElementById("fullsize").src = "images/vehicles/<?=$car_id?>-" + id + ".jpg";
}
</script>

<?php include "footer.php"; ?>

现在看起来像这样。 screenshot

0 个答案:

没有答案