Jump to content
Fórum Script Brasil
  • 0

Multiupload PHP + Jquery


rudinunescosta@hotmail.com
 Share

Question

Porém tem um detalhe que não estou conseguindo resolver que é fazer upload de mais de 500 fotos de uma unica vez até agora consegui no máximo 200, alguém pode me auxiliar.

Código PHP, original de http://fredimachado.com.br/2012/01/07/novi...1/#comment-1841, sendo adaptado a parte de inserção da marca d'água

upload.html

Upload de fotos

var uploader = new multiUpload('uploader', 'uploader_files', {

swf: 'flash/multiUpload.swf',

script: 'upload.php',

expressInstall: 'flash/expressInstall2.swf',

multi: true

});

function sendIt()

{

var pasta = document.getElementById("txtPasta").value;

if (pasta.length)

{

uploader.setData({

Pasta: pasta

});

uploader.startUpload();

}

else

alert("Digite o nome do album no formato padrão AAAA-MM-DD_NOME_DO_ALBUM.");

}

@import "css/multiUpload.css";

@import 'css/style.css';

Envio de albuns

Voltar ao site

Diretório p/ salvar arquivos:

Iniciar Upload | Limpar fila de Upload

upload.php

<?php

/**

* Script PHP de Upload

*

* @author Carlos Rogério Velozo de Medeiros

* @date 27/08/2009

*

* Salva o arquivo em uma pasta

* Caso a pasta não exista o script cria

*/

//--------------------------------

// CREATE WATERMARK FUNCTION

//--------------------------------

define('WATERMARK_OVERLAY_IMAGE', 'imagens/slogan.png');

define('WATERMARK_OVERLAY_OPACITY', 90);

define('WATERMARK_OUTPUT_QUALITY', 90);

function create_watermark($source_file_path, $output_file_path) {

list( $source_width, $source_height, $source_type ) = getimagesize($source_file_path);

if ($source_type === NULL) {

return false;

}

switch ($source_type) {

case IMAGETYPE_GIF:

$source_gd_image = imagecreatefromgif($source_file_path);

break;

case IMAGETYPE_JPEG:

$source_gd_image = imagecreatefromjpeg($source_file_path);

break;

case IMAGETYPE_JPG:

$source_gd_image = imagecreatefromjpeg($source_file_path);

break;

case IMAGETYPE_PNG:

$source_gd_image = imagecreatefrompng($source_file_path);

break;

default:

return false;

}

$overlay_gd_image = imagecreatefrompng(WATERMARK_OVERLAY_IMAGE);

$overlay_width = imagesx($overlay_gd_image);

$overlay_height = imagesy($overlay_gd_image);

imagecopymerge(

$source_gd_image,

$overlay_gd_image,

$source_width - $overlay_width,

$source_height - $overlay_height,

0,

0,

$overlay_width,

$overlay_height,

WATERMARK_OVERLAY_OPACITY

);

imagejpeg($source_gd_image, $output_file_path, WATERMARK_OUTPUT_QUALITY);

imagedestroy($source_gd_image);

imagedestroy($overlay_gd_image);

}

$file = $_FILES['Filedata'];

$pasta = "imagens/ultimoseventos/" . $_POST['Pasta'];

$path = $file['tmp_name'];

if (!is_dir($pasta))

mkdir($pasta);

$new_path = $pasta . "/" . $file['name'];

$result = create_watermark($path, $new_path);

if ($result === false) {

return false;

} else {

return array($uploaded_file_path, $processed_file_path);

}

//move_uploaded_file($path, $new_path);

echo "1";

?>

Link to comment
Share on other sites

1 answer to this question

Recommended Posts

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share



  • Forum Statistics

    • Total Topics
      150.8k
    • Total Posts
      648.7k
×
×
  • Create New...