Ver Mensaje Individual
  #5 (permalink)  
Antiguo 07/03/2012, 13:19
Avatar de catpaw
catpaw
 
Fecha de Ingreso: mayo-2010
Ubicación: xalapa
Mensajes: 856
Antigüedad: 14 años
Puntos: 23
Respuesta: problema desde host real

hola DooBie

no se como darle los permisos :S en que parte del codigo o como

el script al subirlos (utilizo el plugin uploadify) es:

Código PHP:
<?php
session_start
();

include(
'.conexion_mysql/conecta_db.php');
$conn_mysql conecta_db();

$query_id="select max(id) as last from noticias";
$res_id=mysql_query($query_id) or die ("Error ".mysql_error());
$row_id=mysql_fetch_array($res_idMYSQL_ASSOC);
$id_noticia=$row_id['last'];
mysql_free_result($res_id);
        
$root $_SERVER['DOCUMENT_ROOT'];
$tempFile $_FILES['Filedata']['tmp_name'];
$folder="noticia_".$id_noticia;
$targetPath '/images/images_noticias/uploads/'.$folder.'/';
//    $fileName = $_FILES['Filedata']['name'];
$extension=substr(strrchr($_FILES['Filedata']['name'],"."),1);

$cont=1;
$fileName="noticia_".$id_noticia."_".$cont.".".$extension;
$sql_query="select nombre_img_nt from noticias_images where id_noticia='$id_noticia'";
$res=mysql_query($sql_query) or die('Error en la consulta: '.mysql_error());
while(
$row mysql_fetch_array($res,MYSQL_ASSOC)){
    if(
$row['nombre_img_nt']==$fileName){
        
$cont++;
        
$fileName="noticia_".$id_noticia."_".$cont.".".$extension;
    }
}

$targetFile =  $root.$targetPath.$fileName;
$targetFile_bd =  'images/images_noticias/uploads/'.$folder.'/'.$fileName;

mkdir ($root.'/images/images_noticias/uploads/'.$folder0700true);
move_uploaded_file($tempFile,$targetFile);

/*********************************************************************************/
//pregunto que extension es la imagen que acabo de subir, para hacer la copia de la misma
if ($extension=='jpg' || $extension=='jpeg'){ 
    
$origen imagecreatefromjpeg($targetFile); 

if (
$extension=='png') { 
    
$origen imagecreatefrompng($targetFile); 

if (
$extension=='gif') { 
    
$origen imagecreatefromgif($targetFile); 
}
/******************************REDIMENSIONAR*****************************/
$x imagesx($origen); //saco el ancho 
$y imagesy($origen); //saco el alto
$nx 500//cuanto quiero de ancho
$ny $y*$nx/$x
$destino imagecreatetruecolor(500,$ny); //se crea plantilla con las medidas de la miniatura
        
$posx = (500 $nx) / 2
$posy = (375 $ny) / 2;
 
imagecopyresized($destino,$origen,$posx,$posy,0,0,$nx,$ny,$x,$y); 

imagejpeg($destino $targetFile 100); //se mueve a la carpeta creada antes "anuncio_ID"
    
$sql_insert="Insert into noticias_images (nombre_img_nt, ruta_img_nt, id) values ('$fileName', '$targetFile_bd', '$id_noticia')";
mysql_query($sql_insert) or die('Error en la inserci&oacuten: '.mysql_error());
        
echo 
"ok";
exit();

/*-------------------->SPECIALS THANKS TO<-----------------------*/
/*
Uploadify v2.1.4
Release Date: November 8, 2010

Copyright (c) 2010 Ronnie Garcia, Travis Nickels

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/
?>
y lo que encuentro curioso es que la primera vez al usar el script si me muestra bien las imagenes, pero las siguientes veces ya no

gracias