Advanced search  

News:

CPG Release 1.6.26
Correct PHP8.2 issues with user and language managers.
Additional fixes for PHP 8.2
Correct PHP8 error with SMF 2.0 bridge.
Correct IPTC supplimental category parsing.
Download and info HERE

Pages: [1] 2 3 4   Go Down

Author Topic: signature code like mine...  (Read 67065 times)

0 Members and 3 Guests are viewing this topic.

Deus

  • Contributor
  • Coppermine frequent poster
  • ***
  • Country: gb
  • Offline Offline
  • Gender: Male
  • Posts: 153
    • DJ-Daz
signature code like mine...
« on: October 12, 2005, 01:15:59 am »

"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

Code: [Select]
<?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

Code: [Select]
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://forum.coppermine-gallery.net/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://forum.coppermine-gallery.net/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://forum.coppermine-gallery.net/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.

« Last Edit: March 30, 2009, 10:54:01 am by Deus »
Logged
https://daz-stuff.uk
DJ tutorials, E-Bikes, Movies and videogames.
(https://daz-stuff.uk/daz/signature.png)

Deus

  • Contributor
  • Coppermine frequent poster
  • ***
  • Country: gb
  • Offline Offline
  • Gender: Male
  • Posts: 153
    • DJ-Daz
Re: signature code like mine...
« Reply #1 on: October 12, 2005, 01:31:45 am »

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?
Logged
https://daz-stuff.uk
DJ tutorials, E-Bikes, Movies and videogames.
(https://daz-stuff.uk/daz/signature.png)

Nibbler

  • Guest
Re: signature code like mine...
« Reply #2 on: October 12, 2005, 01:33:55 am »

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.
Logged

Deus

  • Contributor
  • Coppermine frequent poster
  • ***
  • Country: gb
  • Offline Offline
  • Gender: Male
  • Posts: 153
    • DJ-Daz
Re: signature code like mine...
« Reply #3 on: October 12, 2005, 01:37:06 pm »

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

NevilleX

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 34
    • SeGoodies
Re: signature code like mine...
« Reply #4 on: October 12, 2005, 04:21:46 pm »

Thanks for this great script!
What line to change to adjust text?

Deus

  • Contributor
  • Coppermine frequent poster
  • ***
  • Country: gb
  • Offline Offline
  • Gender: Male
  • Posts: 153
    • DJ-Daz
Re: signature code like mine...
« Reply #5 on: October 12, 2005, 05:54:10 pm »


   
   $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.
Logged
https://daz-stuff.uk
DJ tutorials, E-Bikes, Movies and videogames.
(https://daz-stuff.uk/daz/signature.png)

Deus

  • Contributor
  • Coppermine frequent poster
  • ***
  • Country: gb
  • Offline Offline
  • Gender: Male
  • Posts: 153
    • DJ-Daz
Re: signature code like mine...
« Reply #7 on: October 12, 2005, 08:30:15 pm »

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

blobnl

  • Coppermine newbie
  • Offline Offline
  • Posts: 16
Re: signature code like mine...
« Reply #8 on: October 12, 2005, 08:34:46 pm »

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<.342C          

2!!22222222222222222222222222222222222222222222222222P"   
ĵ}!1AQa"q2#BR$3br   
%&'()*456789:CDEFGHIJSTUVWXYZcdefghijstuvwxyz   
ĵw!1AQaq"2B   #3Rbr
$4%&'()*56789:CDEFGHIJSTUVWXYZcdefghijstuvwxyz

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

Deus

  • Contributor
  • Coppermine frequent poster
  • ***
  • Country: gb
  • Offline Offline
  • Gender: Male
  • Posts: 153
    • DJ-Daz
Re: signature code like mine...
« Reply #9 on: October 12, 2005, 10:06:29 pm »

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?
Logged
https://daz-stuff.uk
DJ tutorials, E-Bikes, Movies and videogames.
(https://daz-stuff.uk/daz/signature.png)

Deus

  • Contributor
  • Coppermine frequent poster
  • ***
  • Country: gb
  • Offline Offline
  • Gender: Male
  • Posts: 153
    • DJ-Daz
Re: signature code like mine...
« Reply #10 on: October 12, 2005, 11:32:58 pm »

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...

Code: [Select]
$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;
« Last Edit: October 12, 2005, 11:41:55 pm by Deus »
Logged
https://daz-stuff.uk
DJ tutorials, E-Bikes, Movies and videogames.
(https://daz-stuff.uk/daz/signature.png)

Nibbler

  • Guest
Re: signature code like mine...
« Reply #11 on: October 12, 2005, 11:40:52 pm »

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

Code: [Select]
$im_total = @imagecreatetruecolor($sum_x, 128);
Note: This mod requires GD2
Logged

Deus

  • Contributor
  • Coppermine frequent poster
  • ***
  • Country: gb
  • Offline Offline
  • Gender: Male
  • Posts: 153
    • DJ-Daz
Re: signature code like mine...
« Reply #12 on: October 12, 2005, 11:44:19 pm »

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.
« Last Edit: October 13, 2005, 12:11:14 am by Deus »
Logged
https://daz-stuff.uk
DJ tutorials, E-Bikes, Movies and videogames.
(https://daz-stuff.uk/daz/signature.png)

snork13

  • Contributor
  • Coppermine frequent poster
  • ***
  • Offline Offline
  • Gender: Male
  • Posts: 260
  • Internet! Is that thing still around?
    • Gallery
Re: signature code like mine...
« Reply #13 on: October 17, 2005, 04:13:34 pm »

Logged

londonhogfan

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 28
    • The Razorback Legacy
Re: signature code like mine...
« Reply #14 on: October 17, 2005, 05:40:09 pm »

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

Deus

  • Contributor
  • Coppermine frequent poster
  • ***
  • Country: gb
  • Offline Offline
  • Gender: Male
  • Posts: 153
    • DJ-Daz
Re: signature code like mine...
« Reply #15 on: October 17, 2005, 07:29:51 pm »

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

adik

  • Coppermine newbie
  • Offline Offline
  • Posts: 13
Re: signature code like mine...
« Reply #16 on: October 18, 2005, 09:40:03 am »

How to change the script to get image only from one selected album ??

Deus

  • Contributor
  • Coppermine frequent poster
  • ***
  • Country: gb
  • Offline Offline
  • Gender: Male
  • Posts: 153
    • DJ-Daz
Re: signature code like mine...
« Reply #17 on: October 18, 2005, 12:21:59 pm »

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.
« Last Edit: March 30, 2009, 11:03:17 am by Deus »
Logged
https://daz-stuff.uk
DJ tutorials, E-Bikes, Movies and videogames.
(https://daz-stuff.uk/daz/signature.png)

Deus

  • Contributor
  • Coppermine frequent poster
  • ***
  • Country: gb
  • Offline Offline
  • Gender: Male
  • Posts: 153
    • DJ-Daz
Re: signature code like mine...
« Reply #18 on: January 24, 2006, 06:35:49 am »

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
« Last Edit: February 01, 2006, 09:53:56 am by Deus »
Logged
https://daz-stuff.uk
DJ tutorials, E-Bikes, Movies and videogames.
(https://daz-stuff.uk/daz/signature.png)

Rush_To_Me

  • Coppermine newbie
  • Offline Offline
  • Gender: Male
  • Posts: 17
  • Crazy Mechanic Engineer
    • Enlaces Digitales
Re: signature code like mine...
« Reply #19 on: January 27, 2006, 06:22:40 am »

Hi there mate some questions...

1. It says:

Code: [Select]
$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 isnt 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
Pages: [1] 2 3 4   Go Up
 

Page created in 0.024 seconds with 19 queries.