Advanced search  

News:

cpg1.5.48 Security release - upgrade mandatory!
The Coppermine development team is releasing a security update for Coppermine in order to counter a recently discovered vulnerability. It is important that all users who run version cpg1.5.46 or older update to this latest version as soon as possible.
[more]

Pages: [1]   Go Down

Author Topic: Thumb by ID number - in CPG 1.5  (Read 3593 times)

0 Members and 1 Guest are viewing this topic.

doppler

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 21
Thumb by ID number - in CPG 1.5
« 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

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));
Logged

Nibbler

  • Guest
Re: Thumb by ID number - in CPG 1.5
« Reply #1 on: January 16, 2011, 04:19:48 pm »

Change

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

to

Code: [Select]
$pid = $superCage->get->getInt('id');
Logged

doppler

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 21
Re: Thumb by ID number - in CPG 1.5
« Reply #2 on: January 17, 2011, 12:22:11 am »

Thank you so much
Working fine!
topic - can be close
Logged

doppler

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 21
Re: Thumb by ID number - in CPG 1.5
« Reply #3 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 ?
Logged

doppler

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 21
Re: Thumb by ID number - in CPG 1.5
« Reply #4 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
Logged

Αndré

  • Administrator
  • Coppermine addict
  • *****
  • Country: de
  • Offline Offline
  • Gender: Male
  • Posts: 15765
Re: Thumb by ID number - in CPG 1.5
« Reply #5 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.
Logged

doppler

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 21
Re: Thumb by ID number - in CPG 1.5
« Reply #6 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" ?
Logged

Αndré

  • Administrator
  • Coppermine addict
  • *****
  • Country: de
  • Offline Offline
  • Gender: Male
  • Posts: 15765
Re: Thumb by ID number - in CPG 1.5
« Reply #7 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.
Logged

doppler

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 21
Re: Thumb by ID number - in CPG 1.5
« Reply #8 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
Logged

Αndré

  • Administrator
  • Coppermine addict
  • *****
  • Country: de
  • Offline Offline
  • Gender: Male
  • Posts: 15765
Re: Thumb by ID number - in CPG 1.5
« Reply #9 on: May 07, 2012, 06:07:20 pm »

I guess there's a BOM in your Polish language file. Please attach it as zip file to your next reply.
Logged

doppler

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 21
Re: Thumb by ID number - in CPG 1.5
« Reply #10 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
Logged

doppler

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 21
Re: Thumb by ID number - in CPG 1.5
« Reply #11 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
Logged
Pages: [1]   Go Up
 

Page created in 0.119 seconds with 20 queries.