Angablade Posted May 10, 2008 Share Posted May 10, 2008 Well, Looking at my signature.. it will change depending on what i am listening to.. man i love the GD library.. :) if you want the source.. just ask.. Quote Link to comment Share on other sites More sharing options...
bluntm Posted May 13, 2008 Share Posted May 13, 2008 whats the code for that, and what do you needed to set it up Quote Link to comment Share on other sites More sharing options...
Angablade Posted May 14, 2008 Author Share Posted May 14, 2008 whats the code for that, and what do you needed to set it up I beleave what you need is somethign called "gd library" installed on your server. first add a file called "song.txt" this way, you can use it later for w/e reason. Now, make a file called "write.php" and add this code. <?php //*Constructed by Angablade //=====Protection=====\\ $Username = ""; //Enter your username here.. we use this for protection $Password = ""; // Same as before.. Protection.. $Song = $_GET['song']; $User = $_GET['Username']; $Pass = $_GET['Password']; //=====Error Checking=====\\ $filename = "song.txt"; if (!is_writable($filename)) { echo "<b>ERROR:</b> The file \"$filename\" is not writable. Please chmod \"$filename\" to \"777\"."; exit; } if($User != $Username) { die('I\'m sorry, you have accessed a restricted page! Please hit the back button in your browser to return to the last page you visited!'); } if($Pass != $Password) { die('I\'m sorry, you have accessed a restricted page! Please hit the back button in your browser to return to the last page you visited!'); } if(empty($Song)) { die('I\'m sorry, you have accessed a restricted page! Please hit the back button in your browser to return to the last page you visited!'); } //=====Write Data=====\\ $song = stripslashes($song); $open = fopen("song.txt", "w"); echo "File Opened."; //Debug fwrite($open,$Song); echo "Data wrote."; //Debug $close = fclose($open); echo "File closed."; //Debug //=====Make image=====\\ $yha = "Currently listening to:"; // Enter what you want for this. $copy = "www.2xtreme.org"; // Enter your website here $Song = stripslashes($Song); $im = imagecreatefromjpeg("bg.jpg"); $white = imagecolorallocate($im, 255, 255, 255); $blue = imagecolorallocate($im,f 120, 120, 255); $color = imagecolorallocate($im, 127, 127, 127); $pxa = (imagesx($im) - 7.5 * strlen($yha)) / 4; $pxb = (imagesx($im) - 7.5 * strlen($Song)) / 2 + 55; $pxc = (imagesx($im) - 7.5 * strlen($copy)) /1; imagestring($im, 8, $pxa, 9, $yha, $white); imagestring($im, 3, $pxb, 25, $Song, $blue); imagestring($im, 3, $pxc, imagesy($im) - "15", $copy, $color); $imagelocat = "othermedia.png"; imagepng($im, $imagelocat); imagedestroy($im); ?> now, add a link to the location of the write.php file.. for example "http://www.site.ext/write.php?song=song here&Username=username&Password=Password" and link the image to the same folder as write.php is in. example: "http://www.site.ext/othermedia.php" Now, I use my media player that i made to make a web request to "write.php" with the proper data. I hope i explained well enough. Quote Link to comment Share on other sites More sharing options...
Steve8x Posted June 15, 2008 Share Posted June 15, 2008 Thats a cool idea! I like it, theres only one flaw to it though... It requires you to be listening to music in order for the image to change... So if you stopped listening to music it would show the last song you listened to until you listen to something else... Instead I like the idea of a randomly changing image, on its own without having to listen to music or have any interaction on your part... I know one person who has this sort of thing on his signature, it has his name in a cool image that changes to a random set of images that have the same name with different backgrounds and such... It's really neat as he has a different signature every time you refresh the page... I was trying to think of ways to accomplish this, one idea I had is to make a program that runs in the background of my computer and every second that goes by, it overwrites my signature image, with 1 from a set of images to display... that way every refresh of a page, will produce a different signature image... the way works pretty good as you can see my signature changes every second, between 6 different images Is there anyway to embed an image on a website, and then when your webserver gets a request for that image to send image data from a set of images instead of the person only getting that 1 image? theres gotta be a way... the only way I can think of maybe is modifying apache's source code so that when someone requests a particular image (the one you want to randomize) generate a random number between 1 and the number of images you have to display, and then send that image data... its a thought! :) I'll post the source code to the image rotator if anyone wants it... its written in MASM32 for low memory usage and maximum performance.. EDIT: okay 1 second is too often I changed to every two seconds now... ok whatever I'll just post it anyway... but I wont post the binary only the source so you'll have to compile it yourself! You'll have to change a couple things anyway to customize it for you... It has a hide feature, press CONTROL + ALT + I all at the same time to hide/unhide the window of the program, this way you don't have to look at it the whole time while letting it do its job It will also add it self to the registry to start with windows if desired, just change RegistryAdd to 0 if you don't want that... Change the "YourName.png" to whatever the name of the image is that you embed on a website Change the "Img\YourName%u.png" to whatever the name of the images you want rotated are.. Example for me i have "Steve8x.png" located in the same folder on my webserver as the imgRotate.exe then I have a folder named "Img" in there, and inside that folder I have "Steve1.png", "Steve2.png", "Steve3.png" etc... Pretty simple to use... heres the code :) its only 4KB when compiled ; ««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««« .486 ; create 32 bit code .model flat, stdcall; 32 bit memory model option casemap :none; case sensitive ; include files ; ~~~~~~~~~~~~~ include \masm32\include\windows.inc include \masm32\include\masm32.inc include \masm32\include\gdi32.inc include \masm32\include\user32.inc include \masm32\include\kernel32.inc include \masm32\include\Comctl32.inc include \masm32\include\comdlg32.inc include \masm32\include\shell32.inc include \masm32\include\oleaut32.inc include \masm32\include\dialogs.inc include \masm32\include\advapi32.inc include \masm32\macros\macros.asm ; libraries ; ~~~~~~~~~ includelib \masm32\lib\masm32.lib includelib \masm32\lib\gdi32.lib includelib \masm32\lib\user32.lib includelib \masm32\lib\kernel32.lib includelib \masm32\lib\Comctl32.lib includelib \masm32\lib\comdlg32.lib includelib \masm32\lib\shell32.lib includelib \masm32\lib\oleaut32.lib includelib \masm32\lib\advapi32.lib DlgProc PROTO :DWORD, :DWORD, :DWORD, :DWORD ; Easy Registry Functions For Strings SetRegKeysz PROTO :DWORD, :DWORD, :DWORD, :DWORD GetRegKeysz PROTO :DWORD, :DWORD, :DWORD, :DWORD .data RegistryAdd db 1; change this to zero if you don't want it to start up with windows FileName dd 0 EXEpath dd 0 OvrWrite db 'YourName.png',0; change this to the image you want to overwrite SaveName db 'Img\YourName%u.png',0; change this to the images you want rotated, leave the %u rKey db 'SOFTWARE\Microsoft\Windows\CurrentVersion\Run',0 imgNum dd 01 bufSize db 255 .data? hWnd dd ? hInstance dd ? pathLength dd ? .code ; ««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««« start: mov hInstance, FUNC(GetModuleHandle,NULL) call main invoke ExitProcess,eax ; ««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««« main proc Dialog "MASM Image Rotater", \ ; caption "MS Sans Serif",10, \ ; font,pointsize WS_OVERLAPPED or \ ; styles for WS_SYSMENU or DS_CENTER, \; dialog window 2, \ ; number of controls 50,50,98,30, \ ; x y co-ordinates 1024 ; memory buffer size DlgButton "Quit",WS_TABSTOP, 62, 2, 30, 13, IDCANCEL DlgStatic "Coded By Steve8x", SS_LEFT, 2, 5, 60, 9, 100 CallModalDialog hInstance,0,DlgProc,NULL ret main endp ImgRotate proc stralloc 256 mov [FileName], eax stralloc 255 mov [EXEpath], eax invoke GetRegKeysz, [EXEpath], addr rKey, SADD("ImgRotator"), addr bufSize mov eax, [EXEpath] .if (byte ptr [eax+1] != ':') && ([RegistryAdd] == 1); then it hasn't been added to the registry yet and you want it invoke GetModuleFileNameA, FUNC(GetModuleHandle, 0), [EXEpath], 255 invoke lstrlen, [EXEpath] mov [pathLength], eax invoke SetRegKeysz, [EXEpath], addr rKey, SADD("ImgRotator"), [pathLength] .endif strfree EXEpath ForeverLoop: .if byte ptr [imgNum] == 7; change this to the number of images you have plus 1 mov byte ptr [imgNum], 1 .endif pushad invoke wsprintf, [FileName], addr SaveName, [imgNum] ;invoke OutputDebugStringA, [FileName]; for debug purposes popad invoke CopyFile, [FileName], addr OvrWrite, FALSE add [imgNum], 1 invoke Sleep, 2000 jmp ForeverLoop ImgRotate endp HotkeyHandler proc LOCAL showhide:DWORD mov [showhide], 1 HandleKey: invoke Sleep, 10; For Anti-Lag / NON 100% CPU usage, you should already know this invoke GetKeyState, VK_CONTROL; CONTROL key and al, 80h cmp al, 0 jz HandleKey invoke GetKeyState, VK_MENU; ALT key and al, 80h cmp al, 0 jz HandleKey invoke GetKeyState, 49h; I key and al, 80h cmp al, 0 jz HandleKey ; If all keys CTRL + ALT + I are simultaneously pressed the execution will reach here xor [showhide], 1 ; 1 = SW_SHOWNORMAL, 0 = SW_HIDE invoke ShowWindow, [hWnd], [showhide]; If showhide == 1 it will show the window, 0 it will hide it;) invoke Sleep, 250; so it wont hide/unhide really quickly, if you don't know what i mean try it without jmp HandleKey HotkeyHandler endp ; ««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««« DlgProc proc hWin:DWORD,uMsg:DWORD,wParam:DWORD,lParam:DWORD Switch uMsg Case WM_INITDIALOG invoke CreateThread, 0, 0, addr HotkeyHandler, 0, 0, 0 invoke CreateThread, 0, 0, addr ImgRotate, 0, 0, 0 invoke SendMessage, [hWin], WM_SETICON, 1, FUNC(LoadIcon, NULL, IDI_WARNING) m2m hWnd, hWin return 1 Case WM_COMMAND .if wParam == IDCANCEL jmp quit_dialog .endif Case WM_CLOSE quit_dialog: strfree FileName invoke EndDialog,hWin,0 EndSw return 0 DlgProc endp ; ------------------------------------------------------------------------- SetRegKeysz PROC lpszString:DWORD, lpszKeyName:DWORD, lpszValueName:DWORD, dwStringLength LOCAL Disp :DWORD LOCAL pKey :DWORD invoke RegCreateKeyEx, HKEY_LOCAL_MACHINE, lpszKeyName, NULL, NULL, REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, NULL, addr pKey, addr Disp .if eax == ERROR_SUCCESS invoke RegSetValueEx, pKey, lpszValueName, NULL, REG_SZ, lpszString, dwStringLength invoke RegCloseKey, pKey .endif ret SetRegKeysz ENDP ; ------------------------------------------------------------------------- GetRegKeysz PROC lpszBuffer:DWORD, lpszKeyName:DWORD, lpszValueName:DWORD, dwStringLength:DWORD LOCAL TType :DWORD LOCAL pKey :DWORD mov TType, REG_SZ invoke RegCreateKeyEx, HKEY_LOCAL_MACHINE, lpszKeyName, NULL, NULL, REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, NULL, addr pKey, addr TType .if eax == ERROR_SUCCESS mov eax, REG_DWORD mov [TType], eax invoke RegQueryValueEx, pKey, lpszValueName, NULL, ADDR TType, lpszBuffer, dwStringLength invoke RegCloseKey, pKey .endif ret GetRegKeysz ENDP end start Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.