Ir para conteúdo
Fórum CódigoFonte.net

Redgriffon1

Membros
  • Total de itens

    7
  • Registro em

  • Última visita

  1. Redgriffon1

    Jornal Gazeta News

    Ae galera criei um site mais precisamente um portal de nocias, ainda possui links quebrados mas o layout e funcionalidade do portal já está OK. Dá uma olhadinha e postem comentários, o que vcs acham que seria legal mudar ou adicionar. http://jornalgazetanews.leadhoster.com Ultilizei Dreamweaver CS5 e Fireworks CS5. Páginas todas em PHP, neste portal o adminstrador cadastra as noticias e videos para aparecerem ná primeira página alem de banersinhos de parceiros e publicidade tudo controlado ná area de admin.
  2. Redgriffon1

    [duvida]Upload de Imagem

    Olá galera, Estou com um problema para fazer upload de imagem com banco de dados. O problema é que tudo finciona direito envia as informações para o banco de dados mas não cria a imagem na pasta especifica, quando abro a página onde as informações do banco de dados devem aparecer, os textos aparecem mas a imagem não. Clicando com o botão direito na imagem e abrindo propriedades ele me passa o endereço completo da imagem. Já na pasta onde devia estar a imagem não aparece nada (pasta vasia) segue o código Formulário <?php require_once('../Connections/jornal2.php'); ?> // inclui a conexão <?php include('../class/W3_Image.class.php'); ?> // inclui o arquivo W3_Image.class.php <?php function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") { $theValue = (!get_magic_quotes_gpc()) ? addslashes($theValue) : $theValue; switch ($theType) { case "text": $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL"; break; case "long": case "int": $theValue = ($theValue != "") ? intval($theValue) : "NULL"; break; case "double": $theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL"; break; case "date": $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL"; break; case "defined": $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue; break; } return $theValue; } $editFormAction = $_SERVER['PHP_SELF']; if (isset($_SERVER['QUERY_STRING'])) { $editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']); } if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "form1")) { $strKey = substr( md5( uniqid( microtime())), 0, 28); // aqui criptografei o endereço da imagem $insertSQL = sprintf("INSERT INTO pn_noticias (strNotTitle, strNotText, strNotDescri, strNotImage, strNotHome) VALUES (%s, %s, %s, %s, %s)", GetSQLValueString($_POST['strNotTitle'], "text"), GetSQLValueString($_POST['strNotText'], "text"), GetSQLValueString($_POST['strNotDescri'], "text"), GetSQLValueString($strKey . '.jpg', "text"), GetSQLValueString($_POST['strNotHome'], "text")); mysql_select_db($database_jornal2, $jornal2); $Result1 = mysql_query($insertSQL, $jornal2) or die(mysql_error()); // aqui escrevo como o W3_imagem deve criar e onde deve criar as imagens $strImageTmp = $_FILES['strNotImage']['tmp_name']; $objImg = new W3_Image; $objImg->create( $strImageTmp, 200, 200, "../fotos-noticias/" . $strKey . ".thumb.jpg"); $objImg->create( $strImageTmp, 640, 480, "../fotos-noticias/" . $strKey . ".jpg"); $insertGoTo = "noticias-cadastrar.php?ok=true"; if (isset($_SERVER['QUERY_STRING'])) { $insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?"; $insertGoTo .= $_SERVER['QUERY_STRING']; } header(sprintf("Location: %s", $insertGoTo)); } mysql_select_db($database_jornal2, $jornal2); $query_rsNoticias = "SELECT * FROM pn_noticias"; $rsNoticias = mysql_query($query_rsNoticias, $jornal2) or die(mysql_error()); $row_rsNoticias = mysql_fetch_assoc($rsNoticias); $totalRows_rsNoticias = mysql_num_rows($rsNoticias); mysql_select_db($database_jornal2, $jornal2); $query_rsCategorias = "SELECT * FROM pn_noticias_categorias"; $rsCategorias = mysql_query($query_rsCategorias, $jornal2) or die(mysql_error()); $row_rsCategorias = mysql_fetch_assoc($rsCategorias); $totalRows_rsCategorias = mysql_num_rows($rsCategorias); ?> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <title>Jornal - Cadastrar Noticias</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <link rel="stylesheet" type="text/css" href="../tiny_mce/plugins/contextmenu/css/contextmenu.css"> <style type="text/css"> <!-- .style2 {color: #FF0000} --> </style> <script type="text/javascript" src="../tinymce/jscripts/tiny_mce/tiny_mce.js"></script> <script type="text/javascript"> tinyMCE.init({ mode : "textareas", theme : "advanced" }); </script> </head> <body> <p>&nbsp;</p> <hr> <?php if (isset($_GET['ok'])) { ?> <p align="center" class="style2">Not&iacute;cia Cadastrada com Sucesso! </p> <?php } ?> // aqui criei o formulario <form action="<?php echo $editFormAction; ?>" method="post" enctype="multipart/form-data" name="form1"> <table align="center"> <tr valign="baseline"> <td nowrap align="right">Titulo:</td> <td><input type="text" name="strNotTitle" value="" size="32"></td> </tr> <tr valign="baseline"> <td align="right" valign="top" nowrap>Descri&ccedil;&atilde;o R&aacute;pida </td> <td><textarea name="strNotDescri" cols="32"></textarea></td> </tr> <tr valign="baseline"> <td align="right" valign="top" nowrap>Texto:</td> <td><textarea name="strNotText" cols="32"></textarea></td> </tr> <tr valign="baseline"> <td nowrap align="right">Imagem:</td> <td><input name="strNotImage" type="file" size="32"></td> </tr> <tr valign="baseline"> <td nowrap align="right">Categorias</td> <td><select name="strCatTitle"> <option value=""></option> <?php do { ?> <option value="<?php echo $row_rsCategorias['strCatTitle']?>"><?php echo $row_rsCategorias['strCatTitle']?></option> <?php } while ($row_rsCategorias = mysql_fetch_assoc($rsCategorias)); $rows = mysql_num_rows($rsCategorias); if($rows > 0) { mysql_data_seek($rsCategorias, 0); $row_rsCategorias = mysql_fetch_assoc($rsCategorias); } ?> </select></td> </tr> <tr valign="baseline"> <td nowrap align="right">Aparecer na Primeira Página?:</td> <td> <select name="strNotHome"> <option value="sim" >Sim</option> <option value="n&atilde;o" >N&atilde;o</option> </select> </td> </tr> <tr valign="baseline"> <td nowrap align="right">&nbsp;</td> <td><input type="submit" value="Cadastrar"></td> </tr> </table> <input type="hidden" name="MM_insert" value="form1"> </form> O arquivo W3_Imagem está assim: <?php /** * This class is a workaround for PHP images * Consult the documentation: http://leandrovieira.com/projects/php/w3image * * @category W3invent * @package W3_Image * @author Leandro Vieira Pinho * @copyright Leandro Vieira Pinho * @license FREE * @link http://leandrovieira.com/projects/php/w3image * @version 0.1 */ class W3_Image { /** * Image´s path * * @var string */ public $imagePath = ''; /** * Image´s name, if what name an image should be saved * * @var string */ protected $_imageName = ''; /** * Constructor * * @param string $imagePath */ function __construct($imagePath = '') { $this->imagePath = $imagePath; } /** * Define the image´s path * * @param string $imagePath image´s path */ public function set_image($imagePath = '') { if ( !empty($imagePath) ) : $this->imagePath = $imagePath; endif; } /** * Dfine the image´s name, used in some method like filter, rotate, ... * * @param string $_imageName image´s name */ public function set_image_name($_imageName) { if ( !empty($_imageName) ) : $this->_imageName = $_imageName; endif; return $this; } /** * Get the image´s mime type * * @param string $imagePath image´s path * @return string image´s mime type */ public function get_mime_type($imagePath = '') { return $this->_get_image_info($imagePath,'mime'); } /** * Get the image´s extension * * @param string $imagePath image´s path * @return string image´s extension */ public function get_extension($imagePath = '') { return $this->_get_image_info($imagePath,'extension'); } /** * Get the image´s width and height * * @param string $imagePath image´s path * @return array image´s width and height */ public function get_sizes($imagePath = '') { return $this->_get_image_info($imagePath,'sizes'); } /** * Get the image´s width * * @param string $imagePath image´s path * @return integer image´s width */ public function get_sizex($imagePath = '') { return $this->_get_image_info($imagePath,'sizex'); } /** * Get the image´s height * * @param string $imagePath image´s path * @return integer image´s height */ public function get_sizey($imagePath = '') { return $this->_get_image_info($imagePath,'sizey'); } /** * Get attributes (width and height) of the image and wrap it in a right way to use in HTML tag * * @param string $imagePath image´s path * @return string image´s attributes: width="xxx" height="yyy" */ public function get_attr($imagePath = '') { return $this->_get_image_info($imagePath,'attr'); } /** * Show an especified image in the browser * * @param string $imagePath image´s path */ public function show($imagePath = '') { // If the image path was not informed, use the image path defined in constructor $imagePath = ( !empty($imagePath) ) ? $imagePath : $this->imagePath; $this->_get_image_info($imagePath,'mime'); header('Content-type: ' . $this->_get_image_info($imagePath,'mime')); readfile($imagePath); exit(); } /** * Force the browser download the especified image * * @param string $imagePath image´s path */ public function download($imagePath = '') { // If the image path was not informed, use the image path defined in constructor $imagePath = ( !empty($imagePath) ) ? $imagePath : $this->imagePath; header('Content-type: ' . $this->_get_image_info($imagePath,'mime')); header('Content-Disposition: attachment; filename="' . $this->_get_image_name($imagePath) . '"'); header('Content-Transfer-Encoding: binary'); readfile($imagePath); exit(); } /** * Save an especified image to a current directory with the same name * * @param string $imagePath image´s path */ public function save($imagePath = '',$imageNewPath = '') { // If the image path was not informed, use the image path defined in constructor $imagePath = ( !empty($imagePath) ) ? $imagePath : $this->imagePath; // If the new image path was not informed, use the directory where the file is running $imageNewPath = ( !empty($imageNewPath) ) ? $imageNewPath : getcwd() . '/' . $this->_get_image_name($imagePath); return @copy($imagePath,$imageNewPath); } /** * Rename an especified image * * @param string $imagePath image´s path */ public function rename($imagePath = '',$imageNewPath = '') { // If the image path was not informed, use the image path defined in constructor $imagePath = ( !empty($imagePath) ) ? $imagePath : $this->imagePath; return rename($imagePath,$imageNewPath); } /** * Delete an especified image * * @param string $imagePath image´s path */ public function delete($imagePath = '') { // If the image path was not informed, use the image path defined in constructor $imagePath = ( !empty($imagePath) ) ? $imagePath : $this->imagePath; return @unlink($imagePath); } /** * Create an image starting from a file or a URL * * If the frist parameter, $imagePath, was not informed, the funcion will get the image´s path defined in the constructor * If the third parameter, $strImageName, was not informed, the image will showed in the browser with a header in agreement with the image´s type * * @param string $imagePath image´s path * @param integer $intWidthMax the max width the image can have * @param integer $intHeightMax the max height the image can have * @param string $strImageName the new path and name of the image * @param integer $intQuality the quality of the image will have. For GIF and JPEG inform a number from 0 to 100; for PNG inform from 0 to 9 */ public function create($imagePath = '',$intWidthMax,$intHeightMax,$strImageName = '',$intQuality = 75) { // If the image path was not informed, use the image path defined in constructor $imagePath = ( !empty($imagePath) ) ? $imagePath : $this->imagePath; // Get the original image´s size $arrImageSizes = $this->get_sizes($imagePath); // If the width was taller than height, get how many percent it was if ( $arrImageSizes[0] > $arrImageSizes[1] ) : $intPercent = (100 * $intWidthMax) / $arrImageSizes[0]; // If the height was taller than width, get how many percent it was else : $intPercent = (100 * $intHeightMax) / $arrImageSizes[1]; endif; // Calcula the new image´s size $intNewImageSizeX = $arrImageSizes[0] * ($intPercent / 100); $intNewImageSizeY = $arrImageSizes[1] * ($intPercent / 100); $resourceImage = imagecreatetruecolor($intNewImageSizeX,$intNewImageSizeY); // Verify the image´s type and work in agreement with switch($this->_get_image_info($imagePath,'extension')) : case 'gif' : $image = imagecreatefromgif($imagePath); imagecopyresampled($resourceImage,$image,0,0,0,0,$intNewImageSizeX,$intNewImageSizeY,$arrImageSizes[0],$arrImageSizes[1]); $strImageName = ( !empty($strImageName) ) ? $this->_avoid_extension_different_of_type($strImageName,'gif') : $this->_get_image_name($imagePath); return imagegif($resourceImage,$strImageName,$intQuality); break; case 'jpeg' : $image = imagecreatefromjpeg($imagePath); imagecopyresampled($resourceImage,$image,0,0,0,0,$intNewImageSizeX,$intNewImageSizeY,$arrImageSizes[0],$arrImageSizes[1]); $strImageName = ( !empty($strImageName) ) ? $this->_avoid_extension_different_of_type($strImageName,'jpg') : $this->_get_image_name($imagePath); return imagejpeg($resourceImage,$strImageName,$intQuality); break; case 'png' : $image = imagecreatefrompng($imagePath); imagecopyresampled($resourceImage,$image,0,0,0,0,$intNewImageSizeX,$intNewImageSizeY,$arrImageSizes[0],$arrImageSizes[1]); $strImageName = ( !empty($strImageName) ) ? $this->_avoid_extension_different_of_type($strImageName,'png') : $this->_get_image_name($imagePath); return imagepng($resourceImage,$strImageName,$intQuality{0}); break; endswitch; } /** * Rotate an image with a given angle * * @param string $imagePath image´s path * @param integer $intDegreess angle number */ public function rotate($imagePath = '', $intDegrees) { // If the image path was not informed, use the image path defined in constructor $imagePath = ( !empty($imagePath) ) ? $imagePath : $this->imagePath; // If the method set_image_name wasn´t used to define a image name, get the original image´s name if ( empty($this->_imageName) ) : $this->_imageName = $this->_get_image_name($imagePath); endif; // Verify the image´s type and work in agreement with switch ( $this->_get_image_info($imagePath,'extension' ) ) : case 'gif' : $sourceImage = imagecreatefromgif($imagePath); $imageRotated = imagerotate($sourceImage,$intDegrees,0); return imagegif($imageRotated,$this->_imageName); break; case 'jpeg' : $sourceImage = imagecreatefromjpeg($imagePath); $imageRotated = imagerotate($sourceImage,$intDegrees,0); return imagejpeg($imageRotated,$this->_imageName); break; case 'png' : $sourceImage = imagecreatefrompng($imagePath); $imageRotated = imagerotate($sourceImage,$intDegrees,0); return imagepng($imageRotated,$this->_imageName); break; endswitch; } /** * Apply a filter in an especified image * * @param string $imagePath image´s path * @param string $filterType filter´s name * @param integer $param1 argument one from some filters * @param integer $param2 argument tow from some filters * @param integer $param3 argument three from some filters * @return the image´s source */ public function filter($imagePath = '', $filterType, $param1 = 0, $param2 = 0, $param3 = 0) { // If the image path was not informed, use the image path defined in constructor $imagePath = ( !empty($imagePath) ) ? $imagePath : $this->imagePath; // Verify the image´s extension and work in agreement with switch( $this->_get_image_info($imagePath,'extension') ) : case 'gif' : $imageSource = imagecreatefromgif($imagePath); $this->_set_image_filter($imageSource,$filterType,$param1,$param2,$param3); return imagegif($imageSource,$this->_imageName); imagedestroy($imageSource); break; case 'jpeg' : $imageSource = imagecreatefromjpeg($imagePath); $this->_set_image_filter($imageSource,$filterType,$param1,$param2,$param3); return imagejpeg($imageSource,$this->_imageName); imagedestroy($imageSource); break; case 'png' : $imageSource = imagecreatefrompng($imagePath); $this->_set_image_filter($imageSource,$filterType,$param1,$param2,$param3); return imagepng($imageSource,$this->_imageName); imagedestroy($imageSource); break; endswitch; } /** * Define the filter type, apply the parameters and filter in the image * * @param string $imagePath image´s path * @param string $filterType filter´s name * @param integer $param1 argument one from some filters * @param integer $param2 argument tow from some filters * @param integer $param3 argument three from some filters * @return the image´s source with filter applyed */ protected function _set_image_filter($imageSource,$filterType,$param1,$param2,$param3) { // Array with the available filters $arrFilters = array ( 'negate' => IMG_FILTER_NEGATE, 'grayscale' => IMG_FILTER_GRAYSCALE, 'brightness' => IMG_FILTER_BRIGHTNESS, 'contrast' => IMG_FILTER_CONTRAST, 'colorize' => IMG_FILTER_COLORIZE, 'edgedetect' => IMG_FILTER_EDGEDETECT, 'emboss' => IMG_FILTER_EMBOSS, 'gaussianblur' => IMG_FILTER_GAUSSIAN_BLUR, 'selectiveblur' => IMG_FILTER_SELECTIVE_BLUR, 'meanremoval' => IMG_FILTER_MEAN_REMOVAL, 'smooth' => IMG_FILTER_SMOOTH ); // Verify if the filter needs more than two parameters switch ( $filterType ) : // These effects no need parameters case 'negate' : case 'grayscale' : case 'edgedetect' : case 'emboss' : case 'gaussianblur' : case 'selectiveblur' : case 'meanremoval' : return imagefilter($imageSource,$arrFilters[$filterType]); break; // These effects no need parameters case 'brightness' : case 'contrast' : case 'smooth' : return imagefilter($imageSource,$arrFilters[$filterType],$param1); break; // This effects needs 3 parameters case 'colorize' : return imagefilter($imageSource,$arrFilters[$filterType],$param1,$param2,$param3); break; // This a specific effect - http://www.php.net/manual/en/function.imagefilter.php#73944 case 'sepia' : imagefilter($imageSource,IMG_FILTER_GRAYSCALE); return imagefilter($imageSource,IMG_FILTER_COLORIZE,90,60,40); break; endswitch; } /** * Get informations about an image * * @param string $imagePath image´s path * @param string $strInfo what info do you want? */ protected function _get_image_info($imagePath = '',$strInfo) { // If the image path was not informed, use the image path defined in constructor $arrImageInfo = ( !empty($imagePath) ) ? getimagesize($imagePath) : getimagesize($this->imagePath); switch($strInfo) : // Return an array with width and height of the image case 'sizes' : return array($arrImageInfo[0], $arrImageInfo[1], 'width' => $arrImageInfo[0], 'height' => $arrImageInfo[1]); break; // Return the width of the image case 'sizex' : return $arrImageInfo[0]; break; // Return the height of the image case 'sizey' : return $arrImageInfo[1]; break; // Return image´s attribute: width="xxx" height="yyy" case 'attr' : return $arrImageInfo[3]; break; // Return the image´s mime type case 'mime' : return $arrImageInfo['mime']; break; // Return the image´s extension case 'extension' : return end(explode('/',$arrImageInfo['mime'])); break; endswitch; } /** * Get the image´s name * * @param string $imagePath image´s path */ protected function _get_image_name($imagePath = '') { // If the image path was not informed, use the image path defined in constructor $imagePath = ( !empty($imagePath) ) ? $imagePath : $this->imagePath; // If has TMP extension, means that the file are in local computer and was uploaded if ( preg_match('#.tmp#',$imagePath) ) : return 'W3_Image.' . substr(md5(date('Y-m-d H:i:s')),0,12) . '.' . $this->_get_image_info($imagePath,'extension'); // Instedad, the file are somewhere (http:// or in local directory) else : return end(explode('/',$imagePath)); endif; } /** * Avoid the image´s name has a differente extension of your type * Some images needs your type to maintain certain features. Like, gif animator, PNG alpha transparency. * * @param string $strImageName the image´s name * @param string $strImageType the image´s type */ protected function _avoid_extension_different_of_type($strImageName,$strImageType) { if ( !empty($strImageName) and !empty($strImageType) ) : // Original type $_strImageType = end(explode('.',$strImageName)); $arrImageName = explode($_strImageType,$strImageName); // Check the original image´s type with informed image´s type if ( $_strImageType == $strImageType ) : return $strImageName; else : return $arrImageName[0] . $strImageType; endif; endif; } /** * Lista de funções para um futuro que só Deus sabe quando * - crop * - watermarking * - write * - draw * - log de erros * verificar perfomance * verificar GD e funções */ } ?> Se algem souber por favor me ajudem a corrigir este erro pois preciso terminar um portal de noticias e só falta este erro do upload de imagem. Vlw
  3. Muito obrigada pela sua ajuda Miguel saraiva acessa a cessão Dicas que tem um tutorial completo de Dreamwaver em portugues Link: http://forum.codigofonte.net/index.php?showtopic=10378
  4. Estou criando uma página para divulgação mas infelizmente não abre no IE. Estou usando para crialo e configuralo usando o Dreamweaver MX. Vi em algum forum que existe uma optmização dá página para abrir em certos navegadores, mas não lembro onde foi, se alguem souber o que ouve por favor postem. Preciso muito de ajuda. Testem o link para verem o que acontece vendoja esta é a pagina inicial que estou começando a criar só para testar, ela funciona normalmente, agora a pagina inicial não funciona no IE mas no Firefox funfa normal. Desde já agradeço a ajuda!
  5. Redgriffon1

    [http]Tutorial Dreamweaver MX

    Este tutorial é completo e em português, o arquivo está em pdf. Espero que gostem! Link--->Dreamweaver MX Tamanho: 2962 Kb Poste sua opnião sobre este tópico. Obrigado!
×
×
  • Criar Novo...