[Resuelto] WPForo Advanced Attachments: imágenes en tamaño original

  

2
Inicio del tema

Estoy usando WPForo para mi foro. Además, utilizo wpForo Advanced Attachments: https://gvectors.com/product/wpforo-advanced-attachments/

El problema es que las imágenes subidas se redimensionan... y salen borrosas

Quiero que se muestren en el tamaño en que se subieron (mantener el tamaño original).

¿Cómo puedo hacerlo? 

1 respuesta
2

Ir a: [YOU RSITE]/wp-content/plugins/wpforo-advanced-attachments/includes/class.wpForoAttachUploadHandler.php

y modificar: class.wpForoAttachUploadHandler.php con el siguiente código:

1. Modifique imagemagick_create_scaled_image:

protected function imagemagick_create_scaled_image( $file_name, $version, $options ) {
    list($file_path, $new_file_path) = $this->get_scaled_image_file_paths($file_name, $version);
    
    // Instead of resizing, just copy the file
    if ($file_path !== $new_file_path) {
        return copy($file_path, $new_file_path);
    }

    return true;
}

2. Modifique imagick_create_scaled_image:

protected function imagick_create_scaled_image( $file_name, $version, $options ) {
    list($file_path, $new_file_path) = $this->get_scaled_image_file_paths($file_name, $version);
    
    // Skip resizing logic, just copy the original image
    if ($file_path !== $new_file_path) {
        return copy($file_path, $new_file_path);
    }

    return true;
}

3. Modifique handle_image_file (si es necesario) Si hay algún procesamiento de imagen en este function, asegúrese de que también se omite:

protected function handle_image_file($file_path, $file) {
    // Skip any resizing or processing
    return;
}

Estos cambios garantizan que la imagen conserve su altura y anchura originales durante el proceso de carga al desactivar los pasos de cambio de tamaño en el procesamiento de imágenes functions.

Compartir: