Hi,Sorry if this topic has already been treated. It's my first time here. Five days that I am searching for a solution but can't find it.

My problem : I am trying to create a Facebook application that takes your profile picture and inserts it into a PNG picture.Everything is working fine with some profile pictures and with others, I'm getting a black screen where profile picture is supposed to be inserted. But variables are OK. File paths are OK.I tried with many different profile pictures. With original photos, it's OK. With some cropped pics, its OK also. And some other won't work. Square cropped pics won't work.

Can someone help me out with that ? ... I'm not sure to understand everything I'm doing...

// mirror transparency is 265x335, so I resize the profile picture// to fit this size, keeping widht/height ratioif($x_dim<150 or $y_dim<170){$mult=max(150/$x_dim,170/$y_dim);$final_x=$x_dim*$mult;$final_y=$y_dim*$mult;}

// pasting the resized profile picture on the final imageimagecopyresampled($im,$profile,250-$final_x/2,240-$final_y/2,0,0,$final_x,$final_y,$x_dim,$y_dim);// pasting the mirror on the final imageimagecopyresampled($im,$mirror,0,0,0,0,500,500,500,500);

// starting at font size 0$size=0;// boolean variable to determine if the font fits on the picture$it_fits=true;// increasing font zize by one unit until it won't fit anymoredo{$last_dim=$dim;$size++;$dim=imageftbbox($size, 0,$font,$text);if($dim[4]-$dim[6]>300){$it_fits=false;}}while($it_fits);

GD Support enabledGD Version bundled (2.0.34 compatible)FreeType Support enabledFreeType Linkage with freetypeFreeType Version 2.2.1GIF Read Support enabledGIF Create Support enabledJPG Support enabledPNG Support enabledWBMP Support enabledXPM Support enabledXBM Support enabled

From a quick glance at your script, it appears that if $x_dim < 150 or $y_dim < 170, that $final_x and $final_y are never set. This could cause problems.Also, make sure you're receiving an image in the function. Is $_POST['image'] actually an image? does getimagesize() fail on getimagesize($url); ?

_________________ - A google chrome extension. When you search only results from the past year (or set time period) are displayed. Helps tremendously when using new technologies to avoid outdated results.

Great Put $mult inside of the else too.I'm not sure why you're getting the undefined $dim error, as I'm not familiar with the imageftbbox() function but here is the manual page for ithttp://us3.php.net/imageftbbox

_________________ - A google chrome extension. When you search only results from the past year (or set time period) are displayed. Helps tremendously when using new technologies to avoid outdated results.

Who is online

Users browsing this forum: No registered users and 6 guests

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