vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 3.0 Full Releases (https://vborg.vbsupport.ru/forumdisplay.php?f=33)
-   -   Auto Resize Image Attachments (Avatars & Profile Pic Too).... (https://vborg.vbsupport.ru/showthread.php?t=68429)

John_44 03-10-2005 02:39 PM

Ok, i played around with it. Please notice that i know nothing about PHP, but i was able to track down the Problem:

If i change:

if ($width_factor > $height_factor)
{
$nw = round($w / $width_factor);
$nh = round($h / $width_factor);
}

to:

if ($width_factor > $height_factor)
{
$nw = 400 ;
$nh = round($h / $width_factor);
}

it works. 500,600,1000 -> Anything bigger 400 don?t.
I guess that for some reasons ImeageCreateTrueColor don?t like big numbers.. but i have no Ideas why.
The image i used was a Standart jpg with 1600*1200. Size played no role.

I would really apreciate your help on this topic, as i will definitly extend this genius hack !

What i want to add:
-Other extension (.jpeg,.jpe ...)
-File size

Does anybody know if GDlib can read EXIF Data ?

(Yes my English sucks ;))

John_44 03-10-2005 02:52 PM

Sorry. It works with 450 and 500. But 600 is to mutch. This makes me sick.

(And it is not "ImageCopyResampled". The following line works just fine:

ImageCopyResampled($ni,$im,0,0,0,0,1000,$nh,$w,$h) ; )

John_44 03-10-2005 04:45 PM

If somebody else has the same Problem: As a workaround i use:

$width_factor = $w / 500;
$height_factor = $h / 500;
if ($width_factor > $height_factor)
{
$nw = round($w / $width_factor);
$nh = round($h / $width_factor);
}
else
{
$nw = round($w / $height_factor);
$nh = round($h / $height_factor);
}

$ni=imagecreatetruecolor($nw,$nh);
ImageCopyResampled($ni,$im,0,0,0,0,$nw,$nh,$w,$h);
UnsharpMask($ni);

John_44 03-10-2005 07:43 PM

And i found a Bug: If more than one Image is resized, the script returns an error 500. However the first one is still uploaded.

Anybody else with this error ?

nosaj 03-29-2005 02:02 AM

thanks mini2, installed and working on my vBulletin Version 3.0.7 Forum. :classic:

LiewCF 03-31-2005 06:20 PM

Great! this hack work for my bloggers forum. There is other similar hack too, but it does not work. :)

Thank you!

JohnBee 04-03-2005 10:09 AM

I started to install this hack on 3.0.3
but in the functions_file.php I could not find the section that says:

Code:

@unlink($attachment);
eval('$error = "' . fetch_phrase('attachbaddimensions', PHRASETYPEID_ERROR) . '";');
$errors[] = array(
        'filename' => $attachment_name,
        'error' => $error...

is there another portion of code I should look for?

Blam Forumz 04-18-2005 09:00 PM

for attachments is it possible for them to be clikabkle?

Harley D 04-25-2005 01:32 AM

Quote:

Originally Posted by mini2
No idea on the darker image, I cant reproduce the problem.

I have a PHP Store that has pic resizing, and I've found that gif, jpegs, and pngs.... one of those will darken when resized. try changing the type of file and upload it to see how it renders after being resized.

Harley D 04-25-2005 01:37 AM

Quote:

Originally Posted by Hexemer
Hello,

first, thank you for this nice hack. :)

But, I have a Problem. :disappointed: The uploaded picture is "darker" than the original one.

attachment 1: original
attachment 2: uploaded in my forums

gd version: 2.0.12

Can you help me? :ermm:


I did some more checking and found that .JPG will darken but .GIF doesn't.
So use paint shop or photo shop to change from a JPG to GIF, this should solve this problem. If it does, please post so other will know if it works.


All times are GMT. The time now is 07:36 AM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01287 seconds
  • Memory Usage 1,740KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)bbcode_code_printable
  • (2)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (4)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (10)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete