Thumb by ID number - in CPG 1.5 Thumb by ID number - in CPG 1.5
 

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

Main Menu

Thumb by ID number - in CPG 1.5

Started by doppler, January 16, 2011, 03:58:03 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

doppler

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

Nibbler

Change


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


to


$pid = $superCage->get->getInt('id');


doppler

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

doppler

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 ?

doppler

I am sorry - i have noticed - that code working in english language - but after changing to polish - post problem
I use UTF-8

Αndré

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.

doppler

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" ?

Αndré

Quote from: doppler on May 07, 2012, 01:56:07 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.

doppler

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

Αndré

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

doppler

there is of course
$lang_charset = 'utf-8';

I marked all my add lik " MN" i comments

doppler

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