News:

CPG Release 1.6.28
added submissions from {406man}
cleaned up a few PHP (8.4) deprecations
fixed PHP deprecation in calendar
removed security vulnerability
(please upgrade when possible)

Main Menu

signature code like mine...

Started by Deus, October 12, 2005, 01:15:59 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Deus

"nod to GeorgeCC for the Code"

This can be used on any forum that uses either img or html, and thats quite a few, this generates a HUGE amount of hits for my galleries.

Tested with 1.3.2 and 1.3.5 1.4.2 and 1.4.3


Upload to the root of your gallery.
copy this text and save it... using notepad...as pic.php

<?php

define
('IN_COPPERMINE'true);
define('INDEX_PHP'true);

require(
'include/init.inc.php');
header('content-type: image/jpeg');

$mlink=mysql_connect('localhost','your gallery Database''your password');
mysql_select_db('your gallery database'$mlink);
$sum_x=4;
$pos=4;

if(isset($_GET['q'])) {
$q=$_GET['q'];
} else {
$q=3;
}

if(isset($_GET['alb'])) {
$pics=mysql_query("select filepath, filename from cpg_pictures where aid=".$_GET['alb']." and pwidth>0 order by rand() limit 0,$q");
} else {
$pics=mysql_query("select filepath, filename from cpg_pictures, cpg_albums where cpg_albums.aid=cpg_pictures.aid and pwidth>0 and visibility=0 order by rand() limit 0,$q");
}
if(isset($_GET['txt'])) {
$txt=$_GET['txt'];
} else {
$txt="www.yourwebsiteurl.com";
}


while($pr=mysql_fetch_array($pics)) {
$fname[]="albums/".$pr['filepath']."thumb_".$pr['filename'];
list($width$height$type$attr) = getimagesize("albums/".$pr['filepath']."thumb_".$pr['filename']);
$sum_x+=$width+4;
$ix[]=$width;
$im[]=imagecreatefromjpeg("albums/".$pr['filepath']."thumb_".$pr['filename']); //echo "albums/".$pr['filepath']."thumb_".$pr['filename']."--";
}

$im_total = @imagecreatetruecolor($sum_x128);
for($pn=0$pn<$q$pn++) {
imagecopy($im_total$im[$pn], $pos400$ix[$pn], 120);
$pos=$pos+$ix[$pn]+4;
}
$pos=$pos-$ix[$pn]-4;
//imagecopy($im_total, $im[1], $pos, 4, 0, 0, $ix[1], 120);
//$pos=$pos+$ix[1]+4;
//imagecopy($im_total, $im[2], $pos, 4, 0, 0, $ix[2], 120);

$textcolor imagecolorallocate($im_total255255255);
$last_x=max($pos,168);
imagefilledrectangle($im_total$last_x-168111$last_x+21260);
imagestring($im_total4$last_x-166111$txt$textcolor);
imagejpeg($im_total);

?>



note the parts that need editing at the top and your website url.

next .htacess

RewriteEngine on

RewriteRule ^([^/\&\?]*)pic\.jpg$ pic.php?$1
RewriteRule ^([^/\&\?]*)pic([0-9]*)\.jpg$ pic.php?alb=$2
RewriteRule ^([^/\&\?]*)pic([0-9]*)/([0-9]*)/(.*)\.jpg$ pic.php?alb=$2&txt=$4&q=$3
RewriteRule ^([^/\&\?]*)pic([0-9]*)/(.*)\.jpg$ pic.php?alb=$2&txt=$3


copy and save this as .htaccess

the code worlks like this...
http://www.mess-hall.co.uk/gallery/pic.jpg - this one pulls images from ALL the albums at random.
or
http://mess-hall.co.uk/gallery/pic68.jpg
(https://coppermine-gallery.com/forum/proxy.php?request=http%3A%2F%2Fmess-hall.co.uk%2Fgallery%2Fpic68.jpg&hash=7d229ff0bd52e6115402018aec250ecb180976d0)
or
http://www.mess-hall.co.uk/gallery/pic.jpg
(https://coppermine-gallery.com/forum/proxy.php?request=http%3A%2F%2Fmess-hall.co.uk%2Fgallery%2Fpic60.jpg&hash=e30e90987a5b58bb2eadb09c83bf5a0fe9060448)


the number after pic## is the number of the album you want.
by default, the code chooses 3 pics, but you can select as many or as few as you want.
And change the text inline.

like this
http://mess-hall.co.uk/gallery/pic68/5/Dazbobaby.com.jpg
(https://coppermine-gallery.com/forum/proxy.php?request=http%3A%2F%2Fmess-hall.co.uk%2Fgallery%2Fpic68%2F5%2FDazbobaby.com.jpg&hash=74696a80d4a15a1ebf68a93c65a55170db5723a9)

Notice that this time i have included the url at the end, this can be whatever you want. If your text doesnt fit you will need to adjust some of the code, found at the bottom of pic.php.

Also change all the 120's to what ever your default thumbnail size it, if its 50, change them from 120 to 50, but you will need to adjust the postion of the text for your url, I didnt write the code, so i cant tell you how to do this, just play around.




Now Works with 1.4* too.


Updated: Urls were completely out of date.
All working now.

https://daz-stuff.uk
DJ tutorials, E-Bikes, Movies and videogames.
(https://daz-stuff.uk/daz/signature.png)

Deus

Thanks nibbler, i wold have posted it in here, but it would'nt let me.
Is this normal or is there something wrong with my account?
https://daz-stuff.uk
DJ tutorials, E-Bikes, Movies and videogames.
(https://daz-stuff.uk/daz/signature.png)

Nibbler

It's normal - Regular users can't start new threads in this board - post your hack on the support board instead - it will be moved here if it really is a new mod/hack.

Also links to adult content are fine so long as they are marked as such.

Deus

Tried it on 1.4.1 it didnt work... sorry, i dont know why.
https://daz-stuff.uk
DJ tutorials, E-Bikes, Movies and videogames.
(https://daz-stuff.uk/daz/signature.png)


Deus


   
   $textcolor = imagecolorallocate($im_total, 255, 255, 255);
   $last_x=max($pos,168);
   imagefilledrectangle($im_total, $last_x-168, 111, $last_x+2, 126, 0);
   imagestring($im_total, 4, $last_x-166, 111, $txt, $textcolor);
   imagejpeg($im_total);


just before $txt and the next to bottom line is the text postion...but as i said earlier, have a play around.
https://daz-stuff.uk
DJ tutorials, E-Bikes, Movies and videogames.
(https://daz-stuff.uk/daz/signature.png)


Deus

https://daz-stuff.uk
DJ tutorials, E-Bikes, Movies and videogames.
(https://daz-stuff.uk/daz/signature.png)

blobnl

I get:

<br />
<b>Warning</b>:  imagecopy(): supplied argument is not a valid Image resource in <b>C:\Program Files\xampp\htdocs\fotoforum\pic.php</b> on line <b>42</b><br />
<br />
<b>Warning</b>:  imagecopy(): supplied argument is not a valid Image resource in <b>C:\Program Files\xampp\htdocs\fotoforum\pic.php</b> on line <b>42</b><br />
<br />
<b>Warning</b>:  imagecopy(): supplied argument is not a valid Image resource in <b>C:\Program Files\xampp\htdocs\fotoforum\pic.php</b> on line <b>42</b><br />
ÿØÿàJFIFÿþ>CREATOR: gd-jpeg v1.0 (using IJG JPEG v62), default quality
ÿÛC      

 $.' ",#(7),01444'9=82<.342ÿÛC          

2!!22222222222222222222222222222222222222222222222222ÿÀP"ÿÄ   
ÿĵ}!1AQa"q2'¡#B±ÁRÑð$3br,   
%&'()*456789:CDEFGHIJSTUVWXYZcdefghijstuvwxyzƒ,,...†‡ˆ‰Š'""•–—˜™š¢£¤¥¦§¨©ª²³´µ¶·¸¹ºÂÃÄÅÆÇÈÉÊÒÓÔÕÖרÙÚáâãäåæçèéêñòóôõö÷øùúÿÄ   
ÿĵw!1AQaq"2B'¡±Á   #3RðbrÑ
$4á%ñ&'()*56789:CDEFGHIJSTUVWXYZcdefghijstuvwxyz,ƒ,,...†‡ˆ‰Š'""•–—˜™š¢£¤¥¦§¨©ª²³´µ¶·¸¹ºÂÃÄÅÆÇÈÉÊÒÓÔÕÖ

??? ???
(https://coppermine-gallery.com/forum/proxy.php?request=http%3A%2F%2F82.156.219.246%2Ffotoforum%2Fpic.jpg&hash=b1875bd30c51c96623f1876fccaa05f24adacb24)

Deus

I've never set this up on a local machine, but i'll hazard a guess at Program Files or at least the space in between.
either that or your using a different version of CPG?
https://daz-stuff.uk
DJ tutorials, E-Bikes, Movies and videogames.
(https://daz-stuff.uk/daz/signature.png)

Deus

#10
Sorry BobNL, i cant help you, i didnt write the code, i had someone make it just for me, and i posted it for the benefit of everyone.
If you want help, hang around, somebody will reply eventually.
Please dont PM me asking for help as it would'nt be in the best interest of the community.
Thanks
Deus

My only suggestion... move the path from program files to c:\xampp

now this is around line 42 and relates to your error...


$im_total = @imagecreatetruecolor($sum_x, 128);
for($pn=0; $pn<$q; $pn++) {
imagecopy($im_total, $im[$pn], $pos, 4, 0, 0, $ix[$pn], 120);
$pos=$pos+$ix[$pn]+4;
https://daz-stuff.uk
DJ tutorials, E-Bikes, Movies and videogames.
(https://daz-stuff.uk/daz/signature.png)

Nibbler

Remove the @ on this line and see what message you get.

$im_total = @imagecreatetruecolor($sum_x, 128);

Note: This mod requires GD2

Deus

#12
glad you noticed it needs GD2 nibbler, I never did manage to get GD installed in windows... maybe thats the problem?
But thanks for your input...
Looks like i'm creating work... as ususal.

I've just reinstalled wamp to try and replicate the error, so far, no luck, as soon as i copy .htaccess to coppermine, coppermine is no longer accessable, seems like an apache problem.

So as you can see, it was written specifically for me, I just hope others can benfit from it too.
Sorry Devs if it creates work for you... as you know, I know nothing about coding, I just wanted to share it.
https://daz-stuff.uk
DJ tutorials, E-Bikes, Movies and videogames.
(https://daz-stuff.uk/daz/signature.png)

snork13


londonhogfan

(https://coppermine-gallery.com/forum/proxy.php?request=http%3A%2F%2Fwww.razorbacklegacy.com%2Fhog_archive%2Fpic.jpg&hash=3d1b2bbde092be74414169a519ae11559f8adf22)

Deus

your both welcome, i hope it help generates traffic for you... It does for me.
https://daz-stuff.uk
DJ tutorials, E-Bikes, Movies and videogames.
(https://daz-stuff.uk/daz/signature.png)


Deus

#17
Quote from: adik on October 18, 2005, 09:40:03 AM
How to change the script to get image only from one selected album ??

the code worlks like this...
http://www.widescreenwallpapers.co.uk/wallpaper/pic.jpg - this one pulls images from ALL the albums at random. ** Produces some blank images, I thinks its a problem with my install, but if anyone else has this problem. plesae notify me **
or
http://mess-hall.co.uk/gallery/pic1.jpg
or
http://www.mess-hall.co.uk/gallery/pic12.jpg

the number after pic## is the number of the album you want.
by default, the code chooses 3 pics, but you can select as many or as few as you want.

like this
http://www.mess-hall.co.uk/gallery/pic1/7/Widescreenwallpapers.jpg

Notice that this time i have included the url at the end, this can be whatever you want. If your text doesnt fit you will need to adjust some of the code, found at the bottom of pic.php.
https://daz-stuff.uk
DJ tutorials, E-Bikes, Movies and videogames.
(https://daz-stuff.uk/daz/signature.png)

Deus

#18
this is to display any number of images from 1 to the number in that album...


http://www.widescreenwallpapers.co.uk/wallpaper/pic1/1/.jpg - games album
or
http://www.widescreenwallpapers.co.uk/wallpaper/pic2/1/.jpg - movies album

just add /1/ before .jpg or add 20 if you like !

Also works with 1.4.3
https://daz-stuff.uk
DJ tutorials, E-Bikes, Movies and videogames.
(https://daz-stuff.uk/daz/signature.png)

Rush_To_Me

Hi there mate some questions...

1. It says:

$mlink=mysql_connect('localhost','your gallery Database', 'your password');
mysql_select_db('your gallery database', $mlink);


In the $mlink=mysql_connect('localhost','your gallery Database', code the second where it says your gallery database isn´t your user to the database???
¿And for the password wich one is it? the one for the Database? or the password to CPG admin??

Wich lines i have to update?

Because i son't know if i have to edit this ones:

Quote"select filepath, filename from cpg_pictures where aid=".$_GET['alb']." and pwidth>0 order by rand() limit 0,$q"

2. Does it work if CPG is bridged??

3. Might sound stupid but can u make a more detailed explanation....  ??? because im new with php and MySQL and i'm having a hard time configuring this signature.. but im willing to try it ;)

Regards