PHP + Logic geniuses please inquire within

Marketcake

God of Leisure
Dec 6, 2009
450
8
0
Paradise
Hey, i have a portfolio and it makes it way easier to show thumbnails using timthumb.php:

link:
TimThumb PHP Script Released | Darren Hoyt Dot Com
Sourcecode:
http://timthumb.googlecode.com/svn/trunk/timthumb.php

the problem is... it seems that the way timthumb 'zooms in' is on exactly the middle of the image. It takes the image, scales it down so the aspect ratio stays the same, but instead of choosing the top of the image it goes to the middle.

is there any way i can get it to keep its aspect ratio, but at the top of the image (this is where the graphical elements of my designs are most prominant.) Instead it keeps zooming in on the middle where its only boring whitespace or text

I have looked at the php file to try and figure it out myself but all the logic loops and variables and math equations or recursions or mastications or masturbations make my head fucking hurt.

Thanks
 


Change this:

Code:
imagecopyresampled( $canvas, $image, 0, 0, $src_x, $src_y, $new_width, $new_height, $src_w, $src_h );
to this:

Code:
imagecopyresampled( $canvas, $image, 0, 0, $src_x, 0, $new_width, $new_height, $src_w, $src_h );
By replacing the $src_y variable with 0 it starts the crop from the top of the picture.
 
Lemsip you are a god among men <3

Ps. Is that the same lemsip I'm thinking of? You can only buy it in Europe. It's banned in US but its fucking strong as shit and when you're sick you are fine the next day
 
Lemsip you are a god among men <3

Ps. Is that the same lemsip I'm thinking of? You can only buy it in Europe. It's banned in US but its fucking strong as shit and when you're sick you are fine the next day

ha I have a cupboard full of that stuff..

LemsipMaxFluLemon.jpg
 
No problem, and yeah thats the stuff. Cant beat it when you feel like crap but have shit to do.