Redimensionar imagem php help please

  • Autor Autor Edrien
  • Data de início Data de início
Tradução em andamento: em alguns minutos este tópico estará em português. Por enquanto, o conteúdo está no original em espanhol. Ver original
Edrien

Edrien

Préstamo en curso
Lambda
Verificación en dos pasos activada
Buenas alguien tendera algún código php, para dimensionar solo el tamaño de una imagen, es decir un ejemplo:

miweb.com/resize.jpg?w=143&h=80&url=LA URL DE LA IMAGEN.

solo el tamaño.
 
Foi útil? Participe da conversa

Com sua conta grátis você pode responder, mandar mensagem privada ao autor e comprar com Saldo retido: o pagamento é liberado quando você recebe o combinado.

Leva 30 segundos · você volta a este tópico ao terminar
Con este código es simple

PHP:
<?php
function resize_imagejpg($file, $w, $h) {
   list($width, $height) = getimagesize($file);
   $src = imagecreatefromjpeg($file);
   $dst = imagecreatetruecolor($w, $h);
   imagecopyresampled($dst, $src, 0, 0, 0, 0, $w, $h, $width, $height);
   return $dst;
}
function resize_imagepng($file, $w, $h) {
   list($width, $height) = getimagesize($file);
   $src = imagecreatefrompng($file);
   $dst = imagecreatetruecolor($w, $h);
   imagecopyresampled($dst, $src, 0, 0, 0, 0, $w, $h, $width, $height);
   return $dst;
}
  $foto = 'foto.jpg';
  $test =  resize_imagejpg($foto, 550, 550);
  imagejpeg($test, 'foto_nueva.jpg');
 
Con este código es simple

PHP:
<?php
function resize_imagejpg($file, $w, $h) {
   list($width, $height) = getimagesize($file);
   $src = imagecreatefromjpeg($file);
   $dst = imagecreatetruecolor($w, $h);
   imagecopyresampled($dst, $src, 0, 0, 0, 0, $w, $h, $width, $height);
   return $dst;
}
function resize_imagepng($file, $w, $h) {
   list($width, $height) = getimagesize($file);
   $src = imagecreatefrompng($file);
   $dst = imagecreatetruecolor($w, $h);
   imagecopyresampled($dst, $src, 0, 0, 0, 0, $w, $h, $width, $height);
   return $dst;
}
  $foto = 'foto.jpg';
  $test =  resize_imagejpg($foto, 550, 550);
  imagejpeg($test, 'foto_nueva.jpg');

imagejpeg($test, 'foto_nueva.jpg');

en esta parte pondria la ruta de la iamgen verdad¨='?
 
imagejpeg($test, 'foto_nueva.jpg');

en esta parte pondria la ruta de la iamgen verdad¨='?

Si, esa seria la ruta de la imagen ya redimensionada
 

Tópicos similares

S
Respostas
3
Visitas
530
imported_OLMID
I
Voltar
Topo