Código PHP:
Ver original<?php
$registros = 15;
$SrcImg = ''; //agregue esta variable que es donde asignaremos la ruta de la imagen =D
$ScaleImg = ''; //esta variable obtendra el nuevo ancho y alto de tu imagen...
if(!$_GET['pagina']){
$inicio = 0;
$_GET['pagina'] = 1;
}else{
$inicio = ($_GET['pagina'] - 1) * $registros;
}
function imageResize($width, $height, $_MaxWidth, $_MaxHeight, $OtherPass) {
if ($width > $height) {
$percentage = ($_MaxWidth / $width);
} else {
$percentage = ($_MaxHeight / $height);
}
$width = round($width * $percentage); $height = round(($height * $percentage)); if($width > $_MaxWidth){
$TempWidth = ($width - $_MaxWidth);
$width = ($width - $TempWidth);
$height = ($height - $TempWidth);
}
if($height > $_MaxHeight){
$TempHeight = ($height - $_MaxHeight);
$height = ($height - $TempHeight);
$width = ($width - $TempHeight);
}
if($OtherPass){
imageResize($width, $height, $_MaxWidth, $_MaxHeight, false);
}
return "width=\"$width\" height=\"$height\"";
}
$total_paginas = ceil($total_registros / $registros);
$qry=$resultados;
//aqui leer resultados y guardarlos en $resultados
$qry=$resultados;
echo "
<table width='500' border='1' align='center' bordercolor='#000066'>
";
$columnas = 3;
if ( $columnas == 3 ) {
echo "<tr>";
}
echo "<td >";
$SrcImg = '../../objetos/animales/'.$row['id'].'.jpg';
$ScaleImg = imageResize($ImgSize[0], $ImgSize[1], 76, 100, true);
echo "
<table align='center'>
<tr>
<td rowspan='2'><audio id='audioTestElem' src='../../audio/animales/$row[solucion].mp3' autobuffer >
</audio>
<div onclick='audioTestElem.play()'><img src='$SrcImg' $ScaleImg</div> </td>
<td rowspan='2'><img src='$SrcImg' $ScaleImg></td>
<td style='color:#CC3300' >$row[solucion]</td>
</tr>
<tr>
<td >$row[espanol]</td>
</tr>
</table>
";
echo "</div>
<div id='3inf'>
</div><br></td>";
$columnas--;
if ( $columnas == 0 ) {
echo "</tr>";
$columnas = 3;
}
}
echo "</table>";
if($_GET['pagina'] > 1) {
echo "<a href='http://aprendiendoinglesejercicios.com/ingles/vocabulario/".$pagina.".php?pagina=1'><< Primera</a> ";
}
if($_GET['pagina'] > 2) {
echo "<a href='http://aprendiendoinglesejercicios.com/ingles/vocabulario/".$pagina.".php?pagina=".($_GET['pagina']-1)."'>< Anterior</a> ";
}
for($i=($_GET['pagina']-2); $i <= ($_GET['pagina']+2); $i++){
if(($i > 0) && ($i <= $total_paginas)){
if($_GET['pagina'] == $i){
echo "<b>".$i."</b> ";
}else{
echo "<a href='http://aprendiendoinglesejercicios.com/ingles/vocabulario/". $pagina.".php?pagina=$i'>$i</a> ";
}
}
}
if($_GET['pagina'] < ($total_paginas-1)){
echo " <a href='http://aprendiendoinglesejercicios.com/ingles/vocabulario/".$pagina.".php?pagina=".($_GET['pagina']+1)."'>Siguiente ></a>";
}
if($_GET['pagina'] < $total_paginas){
echo " <a href='http://aprendiendoinglesejercicios.com/ingles/vocabulario/".$pagina.".php?pagina=".$total_paginas."'>Última >></a>";
}
?>