forum.coppermine-gallery.net
No Support => Modifications/Add-Ons/Hacks => Mods: Statistics => Topic started by: Deus 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
<?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_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;
}
$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_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);
?>
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://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.
-
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?
-
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.
-
Tried it on 1.4.1 it didnt work... sorry, i dont know why.
-
Thanks for this great script!
What line to change to adjust text?
-
$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.
-
Thanks! ;)
-
no problemo.
-
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
??? ???
-
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?
-
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;
-
Remove the @ on this line and see what message you get.
$im_total = @imagecreatetruecolor($sum_x, 128);
Note: This mod requires GD2
-
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.
-
thanks Deus for sharing...
one thing i had to do was change my cpg prefix to cpg130...
(https://forum.coppermine-gallery.net/proxy.php?request=http%3A%2F%2Fwww.snork13.net%2Fgallery%2Fpic.php&hash=71818bd0e09559cc8bb755254557553b13efe465) (http://www.snork13.net)
-
Thanks, Works great.
-
your both welcome, i hope it help generates traffic for you... It does for me.
-
How to change the script to get image only from one selected album ??
-
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.
-
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
-
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 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:
"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
-
ok, valid questions...
its definetely the database name, (could be database user, as my db user and db name are the same) database password - not cpg password, and data base name again.
Yes it works on bridged setup.
one thing i have noticed too, it wont take images from private albums unless you tell it to by using the pic#.jpg #=album number.
-
;D Thank you very much that helped
However if you try this www.enlaces-digitales.com/gallery/pic.php (http://www.enlaces-digitales.com/gallery/pic.php) doesn't load any image if you see hard enough :P you can see a partial "w" to my website
do i have to add some code to the filepath question?
Thanx again in advanced and thank you very for both things the mod & support ;D
-
i'm not sure whats going on there... maybe a code junkie could help please?
-
Could you post the code you are using, and star out confidential information?
-
Sure.. the only difference is th URL.... ;D
<?php
define('IN_COPPERMINE', true);
define('INDEX_PHP', true);
require('include/init.inc.php');
header('content-type: image/jpeg');
$mlink=mysql_connect('localhost','DATABASE', 'PASSWORD');
mysql_select_db('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.Enlaces-Digitales.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_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;
}
$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_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);
?>
AS you can see it's the same code....
Regards
-
And you added the .htaccess file? If so, are you certain the server allows for mod rewrite?
-
Thanks TranzNDance for helping where I cannot.
-
Yes i uploaded the .htacces file, but how can i know tha my webserver allows mod rewrite? is there something tu run like phpinfo()
Altough is uploaded in the root of my site or the galler... ??? (kinda new here ;D)
And as Deus pointed:
Thanks TranzNDance for helping where I cannot.
Thank you very much
Regards
Manuel
-
8) I want to apologize to post so quickly, i found that the webserver allows the mod rewrite.. I'll show you how i noticed it :P
In deus's first post:
http://www.ripoffbritain.org/wallpaper/pic75/5/www.ripoffbritain.org.jpg (http://www.ripoffbritain.org/wallpaper/pic75/5/www.ripoffbritain.org.jpg) If you try this and put another thing in the www.domain.com you can change it..
In my site http://www.enlaces-digitales.com/gallery/pic5/5/www.ripoffbritain.org.jpg (http://www.enlaces-digitales.com/gallery/pic5/5/www.ripoffbritain.org.jpg) you can do it too, (the problem is that the rectangle is so small... i think).
Sorry for this post
-
well, I can tell you, its nothing to do with the database access, I've just entered for username "Any", Database "any", and password "any" so its not a typo in there.!! LOL
My suggestion would be to now ask your webhost to tell you if that mod rewrite is enabled for you, if not, ask them if they could enable it.
-
first of all i enter the panel and i saw that the hotlinking feature was enable, after that i took a look to the .htaccess from there an i found this:
RewriteEngine on
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http://enlaces-digitales.com/.*$ [NC]
RewriteCond %{HTTP_REFERER} !^http://enlaces-digitales.com$ [NC]
RewriteCond %{HTTP_REFERER} !^http://www.enlaces-digitales.com/.*$ [NC]
RewriteCond %{HTTP_REFERER} !^http://www.enlaces-digitales.com$ [NC]
RewriteCond %{HTTP_REFERER} !^http://www.enlaces-digitales.com/gallery/.*$ [NC]
RewriteCond %{HTTP_REFERER} !^http://www.enlaces-digitales.com/gallery$ [NC]
RewriteCond %{HTTP_REFERER} !^http://www.enlaces-digitales.com/gallery/albums/.*$ [NC]
RewriteCond %{HTTP_REFERER} !^http://www.enlaces-digitales.com/gallery/albums$ [NC]
RewriteCond %{HTTP_REFERER} !^http://www.google.com/.*$ [NC]
RewriteCond %{HTTP_REFERER} !^http://www.google.com$ [NC]
RewriteCond %{HTTP_REFERER} !^http://www.google.com.mx/.*$ [NC]
RewriteCond %{HTTP_REFERER} !^http://www.google.com.mx$ [NC]
RewriteRule .*\.(jpg|jpeg|gif|png|bmp)$ www.juras.com [R,NC]
Do i have to deactivate this feature and add the lines or can just add the lines???
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
-
i believe you just add
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
to the htaccess, try it anyway, it cant hurt.
-
One very basic mistake in above given code.
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");
}
In all queries cpg_ should be replaced by the prefix you are using. This should solve the problem.
-
er... Hi Abbas, thanks for helping out here :D and helping get my site sorted.
Deus.
-
Good find, Abbas.
@Deus, what you can do is replace references to the tablenames with variables like these: {$CONFIG['TABLE_PICTURES']}, {$CONFIG['TABLE_ALBUMS']}
It will take into account the user's table prefix. This would make your code work regardless of mysql setup.
-
;D Thank you very much Abbas but i can't geit it to work i've just changed the prefix to cpg143_ Because um using that version... :P
Thank you all ... i think i found the problem, it's Cpanel... if i use the hotlinking feature it mess up my settings so what i did was:
1. Change the prefix in pic.php @Thank you Abbas.
2. Disable the hotlinking feature from CPanel.
3. Put my own .htaccess
But guess.... nothing happended :'(
It shows a tiny vertical rectangle with a partial "w"
I have CPG configured in spanish... does the installation be different for the language???
Thanx again
Manuel
-
If you have updated from cpg1.3.5 to cpg1.4.3 then your prefix would still be cpg135_ since upgradation doesn't change the prefix. I would recommend to use the method suggested by TranzNDance.... i.e. replace cpg_pictures with {$CONFIG['TABLE_PICTURES']} etc... in all queires.
-
Good find, Abbas.
@Deus, what you can do is replace references to the tablenames with variables like these: {$CONFIG['TABLE_PICTURES']}, {$CONFIG['TABLE_ALBUMS']}
It will take into account the user's table prefix. This would make your code work regardless of mysql setup.
If you have updated from cpg1.3.5 to cpg1.4.3 then your prefix would still be cpg135_ since upgradation doesn't change the prefix. I would recommend to use the method suggested by TranzNDance.... i.e. replace cpg_pictures with {$CONFIG['TABLE_PICTURES']} etc... in all queires.
Done i wasnt reading with attention until i found Abbas Post, i did that and the rectangle wont open wide enough to display the photos ;(
By the way my CPG its 143 Fresh, i mean i didn't upgrade it
Again Thankx a lot..
Manuel
-
I don't know what to suggest.... may be we need to debug that script. If you want you can you PM me your site access so that i can take a look.
-
After debugging i found that mysql_query() function was failing and hence was causing problem. I replaced mysql_query() with cpg_db_query() and it started working. I think now Rush_To_Me's script is working....
Abbas
-
If Abbas has it working, can we see your sig now please Rush?
-
THANKS A LOT!!! ;D You guys surely are awsome so here it goes:
http://www.enlaces-digitales.com/gallery/pic.php (http://www.enlaces-digitales.com/gallery/pic.php)
@Deus Thank you for the script!
@TranzNDance Thank you for your comments
@Abbas Ali I don't have enough words to repay the favor
I will study PHP a little more to help people like you guys ;)
One again Thank you for all
Manuel
-
i configured the code to my liking but i cant seem to get the ".jpg" extension to work.
i have added in my .htaccess:
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
http://www.teamdirtytricks.net/drunktank/pic.php (http://www.teamdirtytricks.net/drunktank/pic.php) works just fine, but
http://www.teamdirtytricks.net/drunktank/pic.jpg (http://www.teamdirtytricks.net/drunktank/pic.jpg) produces a 404 error
-
Make sure the mod_rewrite is allowed on your server. Ask your webhost for the same.
-
it is, they said:
ModRewrite is fully enabled in the server your account is on.
Unfortunatly we cannot provide technical assistance with creating
RewriteRule.
anyone got any ideas?
-
Morning,
Is there any security risk if i use only pic.php without .htaccess ?
Because it's work fine as standalone for me !
RewriteRule and mod_rewrite are not allowed on my host ???
PYAP
-
No security risk. You can use it like that. mod_rewrite is used only to make the urls look pretty.
-
Thanx Abbas ;D
Look like that :
(http://) http://www.pays-dignois.com/galerie/random.php (oh oh... this link do not work on 11-30-2006 ??? )
PYAP
-
awesome script there guys. I had almost no probs "installing" it. The thing is that I get an image only with pic.jpg, the other options don't work. I wonder what is wrong! I would like to configure pic1 to be in another resolution after all this is the point in having pic, pic1, ...pic#. Anyone that can help me out here.
here is the link to the pic file: http://paparak.info/pic.jpg
here is the code
<?php
define('IN_COPPERMINE', true);
define('INDEX_PHP', true);
require('include/init.inc.php');
header('content-type: image/jpeg');
$mlink=mysql_connect('localhost','***', '***');
mysql_select_db('***', $mlink);
$sum_x=4;
$pos=4;
if(isset($_GET['q'])) {
$q=$_GET['q'];
} else {
$q=5;
}
if(isset($_GET['alb'])) {
$pics=mysql_query("select filepath, filename from pictures where aid=".$_GET['alb']." and pwidth>0 order
by rand() limit 0,$q");
} else {
$pics=mysql_query("select filepath, filename from {$CONFIG['TABLE_PICTURES']},
{$CONFIG['TABLE_ALBUMS']} where {$CONFIG['TABLE_ALBUMS']}.aid={$CONFIG['TABLE_PICTURES']}.aid and pwidth>0
and visibility=0 order by rand() limit 0,$q");
}
if(isset($_GET['txt'])) {
$txt=$_GET['txt'];
} else {
$txt="http://paparak.info";
}
while($pr=mysql_fetch_array($pics)) {
$fname[]="albums/".$pr['filepath']."th_".$pr['filename'];
list($width, $height, $type, $attr) = getimagesize("albums/".$pr['filepath']."th_".$pr['filename']);
$sum_x+=$width+4;
$ix[]=$width;
$im[]=imagecreatefromjpeg("albums/".$pr['filepath']."th_".$pr['filename']); //echo
"albums/".$pr['filepath']."th_".$pr['filename']."--";
}
$im_total = @imagecreatetruecolor($sum_x, 100);
for($pn=0; $pn<$q; $pn++) {
imagecopy($im_total, $im[$pn], $pos, 4, 0, 0, $ix[$pn], 92);
$pos=$pos+$ix[$pn]+4;
}
$pos=$pos-$ix[$pn]-4;
//imagecopy($im_total, $im[1], $pos, 4, 0, 0, $ix[1], 100);
//$pos=$pos+$ix[1]+4;
//imagecopy($im_total, $im[2], $pos, 4, 0, 0, $ix[2], 100);
$textcolor = imagecolorallocate($im_total, 255, 255, 255);
$last_x=max($pos,150);
imagefilledrectangle($im_total, $last_x-152, 80, $last_x+2, 127, 0);
imagestring($im_total, 4, $last_x-152, 80, $txt, $textcolor);
imagejpeg($im_total);
?>
Thanks in advance
-
I have tried this, but i wont work right.. It i prehaps just me who have forgot something.
http://www.babez.dk/galleri/pic.jpg
I hope you can help me.
Thanks in advange!
-
This is a damn handy script!!!
Here's a copy of the script with all the needed changes in it, or at least all the ones that need to make it work on newer versions.
<?php
define('IN_COPPERMINE', true);
define('INDEX_PHP', true);
require('include/init.inc.php');
header('content-type: image/jpeg');
$mlink=mysql_connect('localhost','dcclorvv_gallery', '6iuni2fr');
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 {$CONFIG['TABLE_PICTURES']} where aid=".$_GET['alb']." and pwidth>0 order by rand() limit 0,$q");
} else {
$pics=cpg_db_query("select filepath, filename from {$CONFIG['TABLE_PICTURES']}, {$CONFIG['TABLE_ALBUMS']} where {$CONFIG['TABLE_ALBUMS']}.aid={$CONFIG['TABLE_PICTURES']}.aid and pwidth>0 and visibility=0 order by rand() limit 0,$q");
}
if(isset($_GET['txt'])) {
$txt=$_GET['txt'];
} else {
$txt="www.dc-6.com/gallery/";
}
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_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;
}
$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_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);
?>
.htaccess
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
-
Tnx it works great.
-
This is great stuff !!!
(https://forum.coppermine-gallery.net/proxy.php?request=http%3A%2F%2Fwww.laurayluis.com%2Fgaleria%2Fpic.jpg&hash=7aaadefd16e08f237da1624963f567e8aa8c78a4) (http://www.laurayluis.com/galeria)
-
Here is mine.
Still testing
(https://forum.coppermine-gallery.net/proxy.php?request=http%3A%2F%2Fwww.madhatt.com%2Fgallery%2Fpic.php&hash=77ae8bb8d11310998a5b20a50a72ebbe026f7f7f)
-
Digging up an old thread.
Is there a way of this code being slightly modified to show just one image from a gallery of the users choice?
ie, I'd like to show a full size signature image, without text, and just the one image?
But it does need to work alongside the same code.
does this make sense?
Thanks in advance,
Darron.
-
I am wondering if anyone fancies commenting in the script.
I've just had an hour of fun randomly changing numbers to get it to work correctly.
I have NO clue of whats what and would love to know what to change to fix things in future.
-
updated URLs, all out of date and broken.
Now they're all ok.
-
With an injection => http://mess-hall.co.uk/gallery/pic.php?q=0 or http://mess-hall.co.uk/gallery/pic.php?q=-1
Breaked ???
-
Where do I edit my template. I don't know what option in the admin controls to chose. To allow me to add my stat code to the footer.
-
it looks like the code isn't working, or at least for me, has anything changed in CPG 1.5.x for it to break the code?
http://cpg.mess-hall.co.uk/pic45.jpg
-
Thanks Dr Preacox for the changes, just reaplced the old code with yours and it works again :)
-
Can anyone / does anyone fancy updating this for 1.6?
It was always beyond me, now so much has changed in PHP I don't stand a chance.