Ver Mensaje Individual
  #7 (permalink)  
Antiguo 14/07/2011, 14:57
Avatar de JuJoGuAl
JuJoGuAl
 
Fecha de Ingreso: julio-2009
Ubicación: Venezuela
Mensajes: 754
Antigüedad: 14 años, 9 meses
Puntos: 19
Respuesta: Redimencionar Imagenes

ok listo, juro que habia hecho eso pero no me lo habia agarrado ya no me arroja web ahora te digo como uso eso en mi projecto? puesto q no estoy subiendo imagen las estoy viendo de una carpeta... si quieres te paso el codigo que llevo:

Código PHP:
Ver original
  1. <?php
  2. require_once('config/BD.php');
  3. require_once 'ResizePicture.php';
  4. mysql_select_db($database_Bdatos, $Bdatos);
  5.  
  6. mysql_select_db($database_Bdatos, $Bdatos);
  7. $queryprod = "SELECT * FROM productos ORDER BY RAND() DESC LIMIT 0,9";
  8. $productos = mysql_query($queryprod, $Bdatos) or die(mysql_error());
  9. $productosrow = mysql_fetch_assoc($productos);
  10. $productostotal = mysql_num_rows($productos);
  11.  
  12. function imageResize($width, $height, $target) {
  13.  
  14. if ($width > $height) {
  15. $percentage = ($target / $width);
  16. } else {
  17. $percentage = ($target / $height);
  18. }
  19. $width = round($width * $percentage);
  20. $height = round($height * $percentage);
  21.  
  22. return "width=\"$width\" height=\"$height\"";
  23. }
  24.                    
  25. ?>
  26. <head>
  27. <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
  28. <title><?php echo $Titulo;?></title>
  29. <link href="adm/Estilos.css" rel="stylesheet" type="text/css" />
  30. <style type="text/css">
  31. <!--
  32. body {
  33.     /*background-image: url(imagenes/fondo.gif);*/
  34.     background:#CCCCCC;
  35.     margin-left: 10px;
  36.     margin-top: 10px;
  37.     margin-right: 10px;
  38.     margin-bottom: 10px;
  39. }
  40. -->
  41. </style>
  42. </head>
  43. <!--<body leftmargin="0" topmargin="13" bgcolor="#F7FEE1" marginheight="0" marginwidth="0">-->
  44. <body>
  45. <table align="center" border="0" cellpadding="0" cellspacing="0" width="940">
  46.     <tbody>
  47.         <tr>
  48.             <!--<td width="21" height="88"><img src="imagenes/izq.png" width="21" height="88"></td>
  49.             <td background="imagenes/full.png" height="88"></td>
  50.             <td width="21" height="88"><img src="imagenes/dere.png" width="21" height="88"></td>-->
  51.             <!--TEMPORAL--><td background="imagenes/fondo2.png" height="88"></td>
  52.         </tr>
  53.     </tbody>
  54. </table>
  55. <table align="center" border="0" cellpadding="0" cellspacing="0" width="940" height="30">
  56.     <tbody>
  57.         <tr>
  58.             <td background="imagenes/fondo3.png"><object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" width="574" height="35" align="right">
  59.               <param name="movie" value="imagenes/Menu.swf">
  60.               <param name="quality" value="high">
  61.               <embed src="imagenes/Menu.swf" width="574" height="35" align="right" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash"></embed>
  62.           </object>         </td>
  63.         </tr>
  64.     </tbody>
  65. </table>
  66. <table align="center" bgcolor="#FFFFFF" border="0" cellpadding="0" cellspacing="5" width="940">
  67.     <tbody>
  68.         <tr>
  69.             <td width="2"></td>
  70.             <td align="left" height="23" valign="top" width="168">
  71.             <br>           
  72.             <table align="center" border="0" cellpadding="0" cellspacing="0" width="175">
  73.             <tbody>
  74.                 <tr>
  75.                     <td width="19"><img src="imagenes/Cu1.png" height="43" width="19"></td>
  76.                     <td align="left" background="imagenes/bg1.png" valign="bottom">
  77.                         <table border="0" cellpadding="0" cellspacing="0">
  78.                             <tbody>
  79.                                 <tr>
  80.                                     <td align="right" valign="top">Categorias</td>
  81.                                     <td align="right" valign="top" width="10"></td>
  82.                                 </tr>
  83.                             </tbody>
  84.                         </table>
  85.                     </td>
  86.                     <td width="19"><img src="imagenes/Cu2.png" height="43" width="19"></td>
  87.                 </tr>
  88.                 <tr>
  89.                     <td background="imagenes/bg2.png" width="19"></td>
  90.                     <td bgcolor="#C7C4C4">
  91.                         <table border="0" cellpadding="0" cellspacing="3" width="100%">
  92.                             <tbody>
  93.                                 <tr>
  94.                                     <td height="5"></td>
  95.                                     <td height="5"></td>
  96.                                 </tr>
  97.                                 <?php do { ?>
  98.                                                                
  99.                                 <tr>
  100.                                     <td valign="top" width="7"><img src="imagenes/lider/Arrow_01.gif" height="11" width="7"></td>
  101.                                     <td><?php echo $rowcate['nombre']; ?></td>
  102.                                 </tr>
  103.                                 <?php } while ($rowcate = mysql_fetch_assoc($categorias)); ?>                                                  
  104.                             </tbody>
  105.                         </table>
  106.                   </td>
  107.                     <td background="imagenes/bg3.png" width="19"></td>
  108.                 </tr>
  109.                 <tr>
  110.                         <td align="left" width="19"><img src="imagenes/Cu3.png" height="35" width="19"></td>
  111.                         <td background="imagenes/bg4.png"></td>
  112.                         <td align="right" width="19"><img src="imagenes/Cu4.png" height="35" width="19"></td>
  113.               </tr>
  114.             </tbody>
  115.             </table>
  116.            
  117.             </td>
  118.             <td valign="top">
  119.             <table border="0" cellpadding="0" cellspacing="0" width="100%">
  120.             <tbody>
  121.                 <tr>
  122.                     <td>
  123.                         Pagina
  124.                     </td>
  125.                     <td align="right">
  126.                     <br>
  127.                     <form action="searchresult.asp" method="get">
  128.                         <table border="0" cellpadding="0" cellspacing="0" width="177">
  129.                             <tr>
  130.                                 <td>
  131.                                 <select name="select" onChange="MM_jumpMenu('parent',this,0)" id="Select1">
  132.                                     <option selected="selected">Buscador de Productos</option>
  133.                                     <?php do { ?>
  134.                                     <option value="<?php echo $rowcate1['ID']; ?>"><?php echo $rowcate1['nombre']; ?></option>
  135.                                     <?php } while ($rowcate1 = mysql_fetch_assoc($categorias1)); ?>
  136.                                 </select>                              
  137.                                 </td>
  138.                             </tr>
  139.                             <tr>
  140.                                 <td>
  141.                                     <input name="Criteria" size="20" type="text">
  142.                                 </td>
  143.                                 <td>
  144.                                     <input name="Enviar" value="Buscar" border="0" type="submit">
  145.                                 </td>
  146.                             </tr>
  147.                         </table>
  148.                     </form>
  149.                     </td>
  150.                 </tr>
  151.                 <tr>
  152.                     <td colspan="2" align="center" height="3"></td>
  153.                 </tr>
  154.                 <tr>
  155.                     <td align="center" height="45">
  156.                     <table width="100%" border="0" cellspacing="0" cellpadding="0" class="paginas_texto">
  157.   <tr>
  158.     <td>
  159.    
  160. <br>
  161.     </td>
  162.   </tr>
  163. </table>
  164.                     </td>
  165.                     <td align="center" valign="top">                       
  166.                     </td>
  167.                 </tr>
  168.                 <tr>
  169.                     <td colspan="2">
  170.                     <!--Productos Destacados-->
  171.  
  172. <table border="0" align="center" cellspacing="5">  
  173.     <?php
  174.     $endRow = 0;
  175.     $columns = 3; // Numero de Columnas
  176.     $hloopRow1 = 0; // Flag
  177.     do
  178.         {
  179.             if($endRow == 0  && $hloopRow1++ != 0)
  180.             echo "<tr>";
  181.             echo "<td>";
  182.             ?>
  183.             <table width="100%" border="0" cellspacing="0" cellpadding="0" align="center">
  184.             <tbody>
  185.                 <tr>
  186.                     <td width="11"><img src="imagenes/imgesq1.png" height="12" width="11" /></td>
  187.                     <td  height="12" background="imagenes/imgful1.png"></td>
  188.                     <td width="11"><img src="imagenes/imgesq2.png" height="12" width="11" /></td>
  189.                 </tr>
  190.                 <tr>
  191.                     <td background="imagenes/imgful3.png" width="11"></td>
  192.                     <td>
  193.                     <?php
  194.                     $raiz="C:/AppServ/www/imagenes/productos/";
  195.                     $imgs= $productosrow['img'];
  196.                     $fil=".jpg";
  197.                     $completo=$raiz
  198.                     .$imgs
  199.                     .$fil;
  200.                     $pix=getimagesize($completo);
  201.                     $width=$pix[0]/1.5;
  202.                     $height=$pix[1]/1.5;
  203.                     ?>
  204.                     <img src="/imagenes/productos/<?php echo $imgs; ?>.jpg" width="<?php echo $width; ?>" height="<?php echo $height; ?>">
  205.                     </td>
  206.                     <td background="imagenes/imgful4.png" width="11"></td>
  207.                 </tr>
  208.                 <tr>
  209.                     <td width="11"><img src="imagenes/imgesq3.png" height="12" width="11" /></td>
  210.                     <td  height="12" background="imagenes/imgful2.png"></td>
  211.                     <td width="11"><img src="imagenes/imgesq4.png" height="12" width="11" /></td>
  212.                 </tr>
  213.             <tbody>
  214.             </table>
  215.  
  216.             <?php
  217.             echo "</td>";
  218.             $endRow++;
  219.             if($endRow >= $columns)
  220.                 {
  221.                     echo "</tr>";
  222.                     $endRow = 0;
  223.                 }
  224.         }
  225.         while ($productosrow = mysql_fetch_assoc($productos));
  226.         ?>
  227.     </table>
  228.                     </td>
  229.                 </tr>
  230.             </tbody>
  231.             </table>
  232.             </td>
  233.             <td width="2"></td>
  234.         </tr>
  235.     </tbody>
  236. </table>
  237. </body>

Ese es, como hago para cuando yo muestres la imagen salga una version mas pequena o grande segun sea el caso...