forum.coppermine-gallery.net

Support => cpg1.5.x Support => cpg1.5 miscellaneous => Topic started by: doppler on January 16, 2011, 03:58:03 pm

Title: Thumb by ID number - in CPG 1.5
Post by: doppler on January 16, 2011, 03:58:03 pm
There is very good add - what was working in CPG 1.4 - possibility of posting a thumb on external page by simply link with id. It worked very well in bbcode of external pages.

After upgrade this link doesn't work any more - Can someone tell what to change?

This is topic of previous version:
http://forum.coppermine-gallery.net/index.php?topic=57377.0 (http://forum.coppermine-gallery.net/index.php?topic=57377.0)

This is an old code (many thanks for Nibbler)
Code: [Select]
<?php

define
('IN_COPPERMINE'true);

require 
'include/init.inc.php';

$pid = (int) $_GET['id'];

$result cpg_db_query("SELECT filename, filepath, url_prefix FROM {$CONFIG['TABLE_PICTURES']} WHERE pid = $pid $ALBUM_SET");

if (!
mysql_num_rows($result)) {
    die(
'Unknown picture');
}

$row mysql_fetch_assoc($result);

$thumb get_pic_url($row'thumb');

$type cpg_get_type($row['filename']);

header('Content-type: ' $type['mime']);

readfile(urldecode($thumb));
Title: Re: Thumb by ID number - in CPG 1.5
Post by: Nibbler on January 16, 2011, 04:19:48 pm
Change

Code: [Select]
$pid = (int) $_GET['id'];

to

Code: [Select]
$pid = $superCage->get->getInt('id');
Title: Re: Thumb by ID number - in CPG 1.5
Post by: doppler on January 17, 2011, 12:22:11 am
Thank you so much
Working fine!
topic - can be close
Title: Re: Thumb by ID number - in CPG 1.5
Post by: doppler on May 06, 2012, 05:31:13 pm
I am sorry - for unnotify this topic - but after upgrade to 1.15.20 this code stoped to work.
After going on
http://my_forum/thumb.php?id=1247 (thumb.php is the code mentioned above)
i have result that "picture ...... cannot be displayed because has errors" (translated) - this is not "critical error"
Is there any change of function  or in names of table which could cause such a problem ?
Title: Re: Thumb by ID number - in CPG 1.5
Post by: doppler on May 06, 2012, 05:46:19 pm
I am sorry - i have noticed - that code working in english language - but after changing to polish - post problem
I use UTF-8
Title: Re: Thumb by ID number - in CPG 1.5
Post by: Αndré on May 07, 2012, 09:03:39 am
Works for me as expected even with the Polish language file. I assume a plugin with a Polish language that produces white spaces causes that issue. Try if it works when you disable the plugin engine. If it works, try to disable each plugin one by one to find the malicious plugin.
Title: Re: Thumb by ID number - in CPG 1.5
Post by: doppler on May 07, 2012, 01:56:07 pm
thanks Andre one more for your help.
I did it - I disabled plugin engine and also disabled each plugin. I disabled even all plugins. Problem still egsist.

I don't know it is imporatant - I discovered that FF (or IE) doesn'ts see type of picture. and when I changed header to text/html it gives me few rowen of symbol (like picture viewed in nnotepad). I did echo $thumb  - it has right adres - but $type gives "Array"
Writing to header just "image/jpg" - doesn't change the problem

if I try view image as text give very small change in FF: no change in characters - but this is change like small white extra line above viewing area.

How to kill the "whitespaces" ?
Title: Re: Thumb by ID number - in CPG 1.5
Post by: Αndré on May 07, 2012, 02:58:47 pm
How to kill the "whitespaces" ?
First of all you need to check if there are malicious white-spaces added to the HTML output at all. Please restore the original thumb.php file and post a link to your gallery, so we can also have a look at that issue.
Title: Re: Thumb by ID number - in CPG 1.5
Post by: doppler on May 07, 2012, 05:00:12 pm
it could be - but not in thumb.php - I restored orignal - problem still egsist.
I noticed on main page extra grey line above everything - it could be this space ?
my Gallery www.genealogia.okiem.pl/foto2
url for thumb is f.ex.
http://www.genealogia.okiem.pl/foto2/thumb.php?id=48237
Title: Re: Thumb by ID number - in CPG 1.5
Post by: Αndré on May 07, 2012, 06:07:20 pm
I guess there's a BOM (http://en.wikipedia.org/wiki/Byte_order_mark) in your Polish language file. Please attach it as zip file to your next reply.
Title: Re: Thumb by ID number - in CPG 1.5
Post by: doppler on May 07, 2012, 06:17:02 pm
there is of course
$lang_charset = 'utf-8';

I marked all my add lik " MN" i comments
Title: Re: Thumb by ID number - in CPG 1.5
Post by: doppler on May 07, 2012, 10:28:27 pm
ugh!
I found what cause the problem
I accidentally changed coding  one of the language file in one plugin - for UTF-8 with BOM (should be - without)
now thumb.php working