BetaArchive Logo
Navigation Home Screenshots Image Uploader Server Info FTP Servers Wiki Forum RSS Feed Rules Please Donate
UP: 7d, 7h, 13m | CPU: 60% | MEM: 1960MB of 4187MB used
{The community for beta collectors}

Forum rules


Any off topic discussions should go in this forum. Post count is not increased by posting here.
FTP Access status is required to post in this forum. Find out how to get it


Post new topic Reply to topic  [ 6 posts ] 
Author Message
 PostPost subject: Image uploader - can anyone help?        Posted: Fri Mar 14, 2008 11:23 pm 
Reply with quote
FTP Access
Offline

Joined
Tue Oct 23, 2007 11:21 pm

Posts
594
I'm creating an image uploader using PHP and GD, but I only get fixed size thumbnails. Question: how can I make dynamic size thumbnails (like BA ones)?

PS: I don't want to transform this question on my third unanswered on programming support.


Top  Profile
 PostPost subject:        Posted: Sat Mar 15, 2008 7:14 am 
Reply with quote
Donator
Offline

Joined
Fri Aug 18, 2006 12:05 pm

Posts
698

Location
Or-stray-liagh
It's not too hard to calculate your thumbnail size from your original image size. Let's say your original is AxB, and you want the thumbnail to be at the maximum 160x160. The aspect ratio of the original image is A/B. Therefore, if your thumbnail is XxY, then X/Y = A/B. If X = 160, then Y = A/(B*160). If Y is < 160, then X and Y are your thumbnail dimensions. If Y is > 160, then let Y = 160, and calculate X by going X = 160*A/B, and this will be your thumbnail size. When you go to create the new thumbnail image in GD, set your width & height to these calculated X and Y values.

_________________
pr0gram the pr0grammer
BetaArchive retiree | OSBA Expat


Top  Profile
 PostPost subject:        Posted: Sat Mar 15, 2008 12:55 pm 
Reply with quote
Administrator
User avatar
Offline

Joined
Fri Aug 18, 2006 11:47 am

Posts
12392

Location
Merseyside, United Kingdom

Favourite OS
Microsoft Windows 7 Ultimate x64
pr0gram the pr0grammer wrote:
It's not too hard to calculate your thumbnail size from your original image size. Let's say your original is AxB, and you want the thumbnail to be at the maximum 160x160. The aspect ratio of the original image is A/B. Therefore, if your thumbnail is XxY, then X/Y = A/B. If X = 160, then Y = A/(B*160). If Y is <160> 160, then let Y = 160, and calculate X by going X = 160*A/B, and this will be your thumbnail size. When you go to create the new thumbnail image in GD, set your width & height to these calculated X and Y values.


I think my brain just went into spasm...

_________________
Image

BetaArchive Discord: https://discord.gg/epK3r6A


Top  Profile  WWW
 PostPost subject:        Posted: Sat Mar 15, 2008 3:45 pm 
Reply with quote
Donator
Offline

Joined
Fri Aug 18, 2006 12:05 pm

Posts
698

Location
Or-stray-liagh
Andy wrote:
I think my brain just went into spasm...


It shouldn't, it's noob maths. :P

_________________
pr0gram the pr0grammer
BetaArchive retiree | OSBA Expat


Top  Profile
 PostPost subject:        Posted: Sat Mar 15, 2008 7:07 pm 
Reply with quote
Administrator
User avatar
Offline

Joined
Fri Aug 18, 2006 11:47 am

Posts
12392

Location
Merseyside, United Kingdom

Favourite OS
Microsoft Windows 7 Ultimate x64
pr0gram the pr0grammer wrote:
Andy wrote:
I think my brain just went into spasm...


It shouldn't, it's noob maths. :P


Yeah I should know as well, I had the same issue when doing BA's image uploader.

_________________
Image

BetaArchive Discord: https://discord.gg/epK3r6A


Top  Profile  WWW
 PostPost subject:        Posted: Sat Mar 15, 2008 9:14 pm 
Reply with quote
FTP Access
Offline

Joined
Tue Oct 23, 2007 11:21 pm

Posts
594
Thanks.

I can't do it now, I'm surfing in a Windows 2000 virtual machine right now.
The virtual machine contains PHP 5 and IIS 5 inside, but...


Top  Profile
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 6 posts ] 




Who is online

Users browsing this forum: No registered users and 5 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Jump to:  

All views expressed in these forums are those of the author and do not necessarily represent the views of the BetaArchive site owner.

Powered by phpBB® Forum Software © phpBB Group

Copyright © 2006-2018

 

Sitemap | XML | RSS