Do not resize image

Asked

Viewed 140 times

1

I am sending my server via php script an image with original size 1000px wide by 350px high but the same is being resized to 800px wide by 280px high and I would like it to remain at the original size.

I use the Wideimage class and my code looks like this:

    $arquivo_destino =  $dir_destino . "/" . $nome_arquivo;
copy($arquivo_origem, $arquivo_destino);

// Vamos usar a biblioteca WideImage para o redimensionamento das imagens
require("../lib/WideImage/WideImage.php");

// INSERE A MARCA D'ÁGUA NA FOTO
// $image = WideImage::load($arquivo_destino);
// $marca = WideImage::load("../imagens/logo-marcadagua.png");

//$image->merge($marca, 'right', 'bottom')->saveToFile($arquivo_destino); 

// Carrega a imagem enviada
$original = WideImage::load($arquivo_destino);

// Redimensiona a imagem original para tamanho miniatura
$arquivo_destino = $dir_destino . "/thumb/" . $nome_thumb;
$original->resize(175, 125, 'inside', 'down')->saveToFile($arquivo_destino);
// Redimensiona e salva

For Thumbs resizing the script works perfectly.

  • I’m not sure I understand the question but.. Couldn’t you just save 2 files? one original and the other to Thumbs?

  • sorry, I hadn’t noticed.. could edit and display the source of $archiv_source in the code?

  • 1

    The source: $file_source = $_FILES['file']['tmp_name']; $dir_destination = ".. /banner"; $cleanupTargetDir = true; // Remove old files $maxFileAge = 5 * 3600; // Temp file age in Seconds

  • Your code looks ok, try this: var_dump(getimagesize($arquivo_destino)); die; after copying the file.

  • 1

    Thank you @Leonardo Bosquett, was with size limitation in sending in the hosting.

1 answer

2

The code is ok, the image is being resized before it even reaches the server, using this command you will see what is being sent to the server and thus get around the problem:

var_dump(getimagesize($arquivo_destino)); die;
  • Thanks for your help @Leonardo Bosquett.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.