View unanswered posts | View active topics
|
Page 1 of 1
|
[ 7 posts ] |
|
| Author |
Message |
|
steet
|
Post subject: Another kind of art...Oh, and the new entrance pics! Posted: Tue Nov 27, 2007 3:11 pm |
|
|
| Animation Source is my home! |
 |
 |
Joined: Fri Dec 31, 2004 2:14 am Posts: 5743 Location: France
Gender: Male
|
You probably all noticed the new entrance pics on the site. I've posted a news about this on the site, but as I know many of you won't notice it, I will post again here : Quote: There's now an automatic generator for entrance pictures. These pics used to be created by the fanart moderators when you submitted pics. The problem is that the site is growing and growing, and the mods couldn't get to make all the pics, not even mentionning the loads of requests for changing your entrance pics. Now, it only takes a few seconds to make a new one, and it's automatic, a bit in the same way it's done on sites like DeviantArt. Of course, the drawback is that they are less accurate than the "human-made" ones, but I've still tried to make them look like the same as before. If you don't like and want to change your current gallery entrance pic, you just have to go to the send page, click on "Gallery options" at the top, and then go to "Change my gallery entrance picture" - just like before, but now they will be changed immediately. I wanted to add that, sorry for the ones of you who were "half-fanart mods" whose job was only to make them : you're fired! (one more example of humans jobs taken by robots!  ) Ah, and as I like to show some of the site code from time to time, so as to make you remember that yes, I code everything on the site myself : This is a sample of the code that generates these entrance pics! - Code: Select all
<?php include_once($lg['incmainft'].'fanimages_send_functions.php');
// Search in a gallery and use the firstly available picture for making the entrance pic function searchMakeMini($nameurl, $pseudo, $type = 'fanart') { global $lg, $modules, $nsite; loadModules($modules, $type); // Get the miniature dimensions $dst_w = $lg[$type]['mini_size'][0]; $dst_h = $lg[$type]['mini_size'][1];
if($type == 'fanimage') { $temp_f = 'f'; $rep = 'desk'; } else { $temp_f = ''; $rep = 'fan'; } $url = $lg['incmainmain']; if($nsite == 2) $url .= $lg['roiliondir']; $url .= 'img/'.$rep.'/'.$nameurl.'/'.$nameurl; $i = 0; $trouve = false; $url2 = ''; echo $url.'<br>'; while($i < 50 && empty($trouve)) { $i++; $url2 = $url.$i.$temp_f; if(file_exists($url2.".jpg")) $trouve = 'jpg'; elseif(file_exists($url2.".gif")) $trouve = 'gif'; elseif(file_exists($url2.".png")) $trouve = 'png'; } if(!empty($trouve)) { @unlink($url.'.'.$trouve); makeMini($url2.'.'.$trouve, $url.'.jpg', $pseudo, $dst_w, $dst_h, $type, $trouve); } }
// Create a small entrance pic function makeMini($img_src,$img_dest, $pseudo, $dst_w = 120, $dst_h = 70, $type = '', $type_img = 'jpg') { global $lg; // Fan images or fanarts if(empty($type)) $type = 'fanimage'; $pseudo = ucfirst($pseudo); // Read the picture dimensions if(!file_exists($img_src)) { echo("The file $img_src doesn't exists!"); return false; } if(filesize($img_src) < 10) { echo("Invalid file size!"); return false; } // Create an empty image with the right dimensions $dst_im = ImageCreateTrueColor($dst_w,$dst_h);
// Copy the source image resized $src_im = LoadImage($img_src, $type_img);
//ImageJpeg($src_im,"test.jpg", 85); // Get picture width and height $size = GetImageSize($img_src);
$src_w = $size[0]; $src_h = $size[1]; // Crop the source image $tmp = cutOriginalPicture($src_im, $dst_im, $src_w, $src_h, $dst_w, $dst_h); $src_im = $tmp[0]; $src_w = $tmp[1]; $src_h = $tmp[2]; if (ImageCopyResampled($dst_im,$src_im,0,0,0,0,$dst_w,$dst_h,$src_w,$src_h) == FALSE) { echo("Probleme while resizing."); return false; } // Fading color $fade_color = 15;
// Get the right font size and cut the pseudo if necessary $font_size = 10; $text_to_display = $pseudo; $factor = 7; // Get the right font sizes according to text length if(strlen($pseudo) < 6) { $font_size = 13; $factor = 8;} elseif(strlen($pseudo) < 9) { $font_size = 11; $factor = 7;} elseif(strlen($pseudo) < 20) { $font_size = 9; $factor = 6.2;} else { $text_to_display = cutLong($pseudo, 20, ' . . .'); $font_size = 8; $factor = 4.1;} // Fade the entire picture $back = imagecolorallocatealpha($dst_im, 255, 255, 255, 80); imagefilledrectangle($dst_im, 0, 0, $dst_w - 1, $dst_h - 1, $back);
// If fanart, make greyscale if($type=='fanart') { $dst_im = full_greyscale($dst_im,$dst_w,$dst_h); } // Add a little white rectangle to write the name $positionx = $dst_w - 10 - strlen($text_to_display) * $factor; $positiony = $dst_h - 15; $tc = imagecolorallocatealpha($dst_im, 255, 255, 255, $fade_color); // alpha color $bgc = imagecolorallocate($dst_im, 0, 0, 0); imagefilledrectangle($dst_im, $positionx + 1, $positiony + 1, $dst_w, $dst_h, $tc); // Vertical shading $fade = $fade_color; for($j=$positiony;$j>($positiony-10);$j--) { $temp_coul = imagecolorallocatealpha($dst_im, 230, 230, 230, $fade); $fade = $fade + 15; if($fade > 127) $fade = 127; for($p=$positionx;$p<$dst_w;$p++) { imagesetpixel($dst_im, $p, $j, $temp_coul); } }
// Horizontal shading $fade = $fade_color; for($p=$positionx;$p>($positionx-10);$p--) { $temp_coul = imagecolorallocatealpha($dst_im, 255, 255, 255, $fade); $fade = $fade + 15; if($fade > 127) $fade = 127; for($j=$positiony;$j<$dst_h;$j++) { imagesetpixel($dst_im, $p, $j, $temp_coul); } }
// At an angle shading $fade = $fade_color; for($p=$positionx;$p>($positionx-10);$p--) { $temp_coul = imagecolorallocatealpha($dst_im, 255, 255, 255, $fade); $fade = $fade + 15; if($fade > 127) $fade = 127; $p2 = $p; for($j=$positiony;$j<$dst_h && $p2<$positionx;$j--, $p2++) { imagesetpixel($dst_im, $p2, $j-1, $temp_coul); } }
// Add the pseudo $txt_color = imagecolorallocate($dst_im, 30, 30, 150); ImageTTFText ($dst_im, $font_size, 1, $positionx + 5, $positiony + 12, $txt_color, $lg['incmainft']."files/eager___.ttf", $text_to_display);
if (ImageJpeg($dst_im,$img_dest, 85) == FALSE) { echo("Impossible to save the picture!"); return false; }
//echo "<IMG SRC='".$img_dest."?t=".time()."' WIDTH=".$dst_w." HEIGHT=".$dst_h.">";
// Destroy the temporary fields @ImageDestroy($dst_im); @ImageDestroy($src_im); return true; }
// Cut the original picture to keep the aspect ratio and keep the most important part function cutOriginalPicture(&$img_src, $img_dst, $src_w, $src_h, $dst_w, $dst_h) { $aspect_ratio = $dst_w / $dst_h; // Temporary sizes $tmp_w = $src_w; $tmp_h = $src_h; $aspect_ratio_orig = $src_w / $src_h; // => width of original picture > width of destination picture if($aspect_ratio_orig < $aspect_ratio) { // => use the destination picture width $tmp_h = $src_w / $aspect_ratio; } else { $tmp_w = $src_h * $aspect_ratio; } // Crop the original picture (with leaving a little space) //$tmp_w = $tmp_w * 0.9; //$tmp_h = $tmp_h * 0.9; $cropLeft = ($src_w - $tmp_w)/2; $cropHeight = ($src_h - $tmp_h)/2;
$im = imagecreatetruecolor($tmp_w,$tmp_h); //echo "aspect_ratio = $aspect_ratio, src = $src_w x $src_h, dst = $dst_w x $dst_h, tmp = $tmp_w x $tmp_h"; //echo "cropleft = $cropLeft, cropheight = $cropHeight"; imagecopy($im, $img_src, 0, 0, $cropLeft, $cropHeight, $tmp_w, $tmp_h); return array($im, $tmp_w, $tmp_h); }
_________________ Webmaster of Animation Source, and more
|
|
| Top |
|
 |
|
devils-angel
|
Post subject: Re: Another kind of art...Oh, and the new entrance pics! Posted: Tue Nov 27, 2007 3:18 pm |
|
|
| Animation Source is my home! |
 |
 |
Joined: Sat Sep 02, 2006 8:56 am Posts: 3555 Location: england boro
|
that is so weired i have just made a topic on the new entrance pics. ohh and i like them very much they are a good update to the sight 
_________________

siggy made by silverhusky
|
|
| Top |
|
 |
|
Kolton
|
Post subject: Re: Another kind of art...Oh, and the new entrance pics! Posted: Tue Nov 27, 2007 4:36 pm |
|
|
| Famous one |
 |
 |
Joined: Fri Mar 16, 2007 7:02 pm Posts: 1520 Location: up ur bum
Gender: Female
|
|
ummm i dont get iot i try to change my entrance pic and its not changing so what am i soposto do with the code? O.o
|
|
| Top |
|
 |
|
steet
|
Post subject: Re: Another kind of art...Oh, and the new entrance pics! Posted: Wed Nov 28, 2007 12:40 pm |
|
|
| Animation Source is my home! |
 |
 |
Joined: Fri Dec 31, 2004 2:14 am Posts: 5743 Location: France
Gender: Male
|
Kolton9988 wrote: ummm i dont get iot i try to change my entrance pic and its not changing so what am i soposto do with the code? O.o Nothing, I just showed the code that allows THE SITE to change the entrance pics, it was just for reference. And, it has probably changed but your browser probably put it in cache so you still see the same one, that's why I said to "wait if it has not immediately changed". If you don't want to wait, press "CTRL + F5" on your keyboard when you're on your fanart page.
_________________ Webmaster of Animation Source, and more
|
|
| Top |
|
 |
|
Mighty
|
Post subject: Re: Another kind of art...Oh, and the new entrance pics! Posted: Wed Nov 28, 2007 5:03 pm |
|
|
| Animation Source is my home! |
 |
 |
Joined: Fri Apr 20, 2007 12:22 pm Posts: 4803 Location: Michigan
Gender: Female
|
|
I think These are rather cool. Alot less stress for the mods.
_________________
|
|
| Top |
|
 |
|
Page 1 of 1
|
[ 7 posts ] |
|
|
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 You cannot post attachments in this forum
|
|