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: analogue thumb call for 'filename' in cpg1410_pictures table  (Read 7766 times)

0 Members and 1 Guest are viewing this topic.

wipqozn1

  • Coppermine regular visitor
  • **
  • Offline Offline
  • Posts: 60

How could I get a name of thumbnail using database query? When I want get a file name I do like this (part of one of my files):

Code: [Select]
    SELECT p.pid, aid, filepath, filename, owner_name, owner_id
//bla bla blah

  $img = "<img src=\"http://url/albums/userpics/normal_{$picture['filename']}\"  border=\"0\">";   

Now I want sth like this:

  $img = "<img src=\"http://url/albums/userpics/<HERE THUMB NAME FOR RECENT IMAGE\"  border=\"0\">"; 

There is no such row in database like "thumb" so I've stuck here...
« Last Edit: May 09, 2007, 07:13:07 am by GauGau »
Logged

Nibbler

  • Guest
Re: analogue thumb call for 'filename' in cpg1410_pictures table
« Reply #1 on: May 06, 2007, 05:44:00 pm »

Same as you have but use thumb_ instead of normal_
Logged

wipqozn1

  • Coppermine regular visitor
  • **
  • Offline Offline
  • Posts: 60
Re: analogue thumb call for 'filename' in cpg1410_pictures table
« Reply #2 on: May 06, 2007, 06:08:14 pm »

Yes, usually it would be like You said but...

I've got different situation here. I've got .swf files and .jpg thumbs. So if I'do like this for file FILE.swf:

Code: [Select]
$img = "<img src=\"http://url/albums/userpics/thumb_{$picture['filename']}\"  border=\"0\">";
It will try to show file thumb called thumb_FILE.swf which does not exist (thumb_FILE.jpg exists instead). So it's not so simple :-)
Logged

Nibbler

  • Guest
Re: analogue thumb call for 'filename' in cpg1410_pictures table
« Reply #3 on: May 06, 2007, 06:10:46 pm »

Then you'd need to use the built-in function, get_pic_url() like this

Code: [Select]
$thumbnail = get_pic_url($row, 'thumb');
where $row is the row from the database for that file. If you are outside Coppermine then you'd need to take a look at the function and build you own version.
Logged

wipqozn1

  • Coppermine regular visitor
  • **
  • Offline Offline
  • Posts: 60
Re: analogue thumb call for 'filename' in cpg1410_pictures table
« Reply #4 on: May 06, 2007, 06:52:50 pm »

Is it mean that it's can't be automatic or I get it wrong?

'cause if I'd like to use this function this way:

Code: [Select]
  $thumbnail = get_pic_url($row, 'thumb');
  $img = "<img src=\"".$thumbnail."\"  border=\"0\">";

then I should give by hand exact name/number of row each time, right (and I'm supposed to pass the row by reference as I see)? And I should create a row for each file?

Regardless of if I'm right or not above, could You show me an example of using this function according to my case?
Logged

Nibbler

  • Guest
Re: analogue thumb call for 'filename' in cpg1410_pictures table
« Reply #5 on: May 06, 2007, 07:30:06 pm »

$row is what you are calling $picture in your code above.

Code: [Select]
$row = mysql_fetch_assoc($result);
$thumbnail = get_pic_url($row, 'thumb');

You don't need to to anything special to pass it by reference; the function does that itself.
Logged

wipqozn1

  • Coppermine regular visitor
  • **
  • Offline Offline
  • Posts: 60
Re: analogue thumb call for 'filename' in cpg1410_pictures table
« Reply #6 on: May 06, 2007, 07:52:30 pm »

Okay, I understand now. Anyway, it gives me an error:

Code: [Select]
Fatal error: Call to undefined function: cpg_get_type() in server_path/include/functions.inc.php on line 1927
It's line inside get_pic_url() definition:

Code: [Select]
$mime_content = cpg_get_type($pic_row['filename']);
cpg_get_type function is defined in /include/media.functions.inc.php - shouldn't this function be global? (I'm a cpp coder, so maybe it's just my cpp deviation)
Logged

Nibbler

  • Guest
Re: analogue thumb call for 'filename' in cpg1410_pictures table
« Reply #7 on: May 06, 2007, 08:00:35 pm »

You'd need to include that file before you call the function.
Logged

wipqozn1

  • Coppermine regular visitor
  • **
  • Offline Offline
  • Posts: 60
Re: analogue thumb call for 'filename' in cpg1410_pictures table
« Reply #8 on: May 06, 2007, 08:16:14 pm »

So i did... now it gives me a mysql error, take a look: http://gryz.pl
Logged

Nibbler

  • Guest
Re: analogue thumb call for 'filename' in cpg1410_pictures table
« Reply #9 on: May 06, 2007, 08:23:38 pm »

I said at the start if you are outside Coppermine you'd need to make your own function. It's not designed to be used form outside Coppermine.
Logged

wipqozn1

  • Coppermine regular visitor
  • **
  • Offline Offline
  • Posts: 60
Re: analogue thumb call for 'filename' in cpg1410_pictures table
« Reply #10 on: May 06, 2007, 08:50:25 pm »

But I use this function inside Coppermine, not outside.
Logged

Nibbler

  • Guest
Re: analogue thumb call for 'filename' in cpg1410_pictures table
« Reply #11 on: May 06, 2007, 09:14:45 pm »

You can't be. If you were then you would not need to include/media.functions.inc.php since it is already included.
Logged

wipqozn1

  • Coppermine regular visitor
  • **
  • Offline Offline
  • Posts: 60
Re: analogue thumb call for 'filename' in cpg1410_pictures table
« Reply #12 on: May 06, 2007, 09:43:48 pm »

I've just downloaded cpg once again to check if I didn't mess up the code - but media.functions.inc.php isn't included in functions.inc.php by default.

I use this function in showweekpic.php file (potd plugin) - 'cause without further modifications in this file it brings me those d**n blank pages.
Logged

Nibbler

  • Guest
Re: analogue thumb call for 'filename' in cpg1410_pictures table
« Reply #13 on: May 06, 2007, 09:53:11 pm »

Right, so you are not in Coppermine.

media.functions.inc.php is included by init.inc.php - it won't work if you include it from somewhere else becuase it needs to refer to things that have been setup in init.inc.php. You can either find what it needs and copy them into your script or make a stripped down version of the function yourself.
Logged

wipqozn1

  • Coppermine regular visitor
  • **
  • Offline Offline
  • Posts: 60
Re: analogue thumb call for 'filename' in cpg1410_pictures table
« Reply #14 on: May 06, 2007, 10:10:23 pm »

Can You do it for me as a 'Paid help'? (I don't start new thread yet in that sub-forum). My PHP programmer has much to do right now and he won't be able to do it as fast as I need  (since he'd analyse a lot of code).
Logged

Nibbler

  • Guest
Re: analogue thumb call for 'filename' in cpg1410_pictures table
« Reply #15 on: May 06, 2007, 10:43:54 pm »

No, but maybe someone else will if you post the request.
Logged

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47843
  • aka "GauGau"
    • gaugau.de
Re: analogue thumb call for 'filename' in cpg1410_pictures table
« Reply #16 on: May 07, 2007, 07:40:55 am »

@wipqozn1: do you want this thread moved to the paid help sub-board.
Logged

wipqozn1

  • Coppermine regular visitor
  • **
  • Offline Offline
  • Posts: 60
Re: analogue thumb call for 'filename' in cpg1410_pictures table
« Reply #17 on: May 08, 2007, 11:36:51 am »

No thanks - I've starded a new thread there where I also put a link to this one :-)
Logged

wipqozn1

  • Coppermine regular visitor
  • **
  • Offline Offline
  • Posts: 60
Logged
Pages: [1]   Go Up
 

Page created in 0.02 seconds with 21 queries.