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: [Solved]: Zufallsbild in anycontent  (Read 6998 times)

0 Members and 1 Guest are viewing this topic.

Hexo

  • Coppermine regular visitor
  • **
  • Offline Offline
  • Gender: Male
  • Posts: 62
[Solved]: Zufallsbild in anycontent
« on: June 04, 2009, 09:00:41 am »

Hallo.

Ich hab bei meiner neuen, überabeiten Galerie vor, die Startseite mittels anycontent zu gestalten.
Das hab ich auch schon so gut wie geschafft, aber was noch super wäre.... das immer von dem neusten Album ein Zufallsbild auf der Startseite wäre. Also ein Zufallsbild des neusten Albums. Das bekomme ich aber leider nicht hin.
In der Suche hab ich keinen Code gefunden, der klappen würde.
Könnte mir evtl. jemand dabei helfen?

Danke schonmal im voraus!

Gruß Hexo
« Last Edit: June 06, 2009, 12:51:22 am by Joachim Müller »
Logged

Αndré

  • Administrator
  • Coppermine addict
  • ****
  • Country: de
  • Offline Offline
  • Gender: Male
  • Posts: 15764
Re: Zufallsbild in anycontent
« Reply #1 on: June 04, 2009, 09:12:47 am »

Keine Ahnung wie weit deine Fähigkeiten reichen, aber evtl. reicht dir das hier schon:
Code: (SQL) [Select]
SELECT * FROM {$CONFIG['TABLE_PICTURES']} WHERE aid IN (SELECT MAX(aid) FROM {$CONFIG['TABLE_ALBUMS']}) ORDER BY RAND() LIMIT 1
Logged

Hexo

  • Coppermine regular visitor
  • **
  • Offline Offline
  • Gender: Male
  • Posts: 62
Re: Zufallsbild in anycontent
« Reply #2 on: June 04, 2009, 12:57:34 pm »

Ich poste heute Abend mal den Inhalt meiner Anycontent.
Im prinzip hab ich noch einen Htmlinhalt in der Anycontent
VOn der Logik her so.
<table>
<tr>
<td>Text</td>
<td>Zufallsbild</td>
<td>Text2</td>
</tr>
</table>

Die Startseite sieh im moment so aus: http://emsfriends.com/beta
und in der Mitte soll das Zufallsbild dann sein... Wie hier: http://emsfriends.com/

Müsste die den Code von dir dann teoretisch in die mittlere Tabelle kopieren?

Αndré

  • Administrator
  • Coppermine addict
  • ****
  • Country: de
  • Offline Offline
  • Gender: Male
  • Posts: 15764
Re: Zufallsbild in anycontent
« Reply #3 on: June 04, 2009, 01:22:34 pm »

Mit meiner SQL-Abfrage erhältst du erstmal nur den Datenbankeintrag zu dem jeweiligen Bild. Diese Daten musst du dann noch weiter verarbeiten.
Logged

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47843
  • aka "GauGau"
    • gaugau.de
Re: Zufallsbild in anycontent
« Reply #4 on: June 04, 2009, 03:15:15 pm »

Wenn Dir die Query von eenemeenemuu nix sagt, dann musst Du nochmal kurz innehalten und Dich fragen, ob Du wirklich diesen Weg gehen willst. Wenn ja, dann einmal kurz Luft holen und dann in den englisch-sprachigen Thread Single random intermediate image in index page abtauchen. Kurz gesagt: cpmFetch ist das Tool unseres Vertrauens, um Inhalte von Coppermine irgendwo anzuzeigen.
Logged

Hexo

  • Coppermine regular visitor
  • **
  • Offline Offline
  • Gender: Male
  • Posts: 62
Re: Zufallsbild in anycontent
« Reply #5 on: June 04, 2009, 03:36:44 pm »

Vielen Dank.
Werde es heute Abend mal testen.

Feedback folgt.

Hexo

  • Coppermine regular visitor
  • **
  • Offline Offline
  • Gender: Male
  • Posts: 62
Re: Zufallsbild in anycontent
« Reply #6 on: June 04, 2009, 09:25:05 pm »

So, es klappt, allerdings hab ich jetzt kein Thumb

Besteht die Möglichkeit auch das Thumbbild zu sehen, statt die mittelgröße?

GRuß

Αndré

  • Administrator
  • Coppermine addict
  • ****
  • Country: de
  • Offline Offline
  • Gender: Male
  • Posts: 15764
Re: Zufallsbild in anycontent
« Reply #7 on: June 04, 2009, 09:39:13 pm »

Ich habe cpmFetch nie benutzt. Aber auf der Demoseite sehe ich Thumbnails. In der cpmFetch-Doku wird das bestimmt auch irgendwo beschrieben sein.
Logged

Hexo

  • Coppermine regular visitor
  • **
  • Offline Offline
  • Gender: Male
  • Posts: 62
Re: Zufallsbild in anycontent
« Reply #8 on: June 05, 2009, 06:55:25 am »

Hab mir die Doku jetzt so gut wie durchgelesen. Entweder bin ich blind, oder ich kapier es nicht, aber ich finde den Punkt nicht :-(

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47843
  • aka "GauGau"
    • gaugau.de
Re: Zufallsbild in anycontent
« Reply #9 on: June 05, 2009, 08:27:49 am »

Tips for asking for help

Here is some advice for posting here.  Note - not a single person here gets paid or compensated in anything but karma for helping.  This is not anyones job and you as the receiver of completely free (and in the case of CPG - very cool) software are owed NOTHING.  Nada. Zilch. Zero.

That being said, lots of people like to help.  In my years as a developer and end-user I have come up with two major rules to getting yourself good free support:

  • Make it as easy as possible for people to help - include all the relevant info you can think of.  If you are not sure if its needed, include it anyway.
  • Prove your research / show your work - List what you have tried, what you have read.  Include the examples of code.  Show that you put in some effort to fix this yourself.

Speaking for myself I will go to great lengths to help someone who is trying.  Some people have no idea, but they try and try.  Other people don't bother, but post a question without trying.  This thread http://forum.coppermine-gallery.net/index.php?topic=35646.0 is a great example of someone who clearly spent time trying to solve a problem.  The thread does not cover the elaborate test pages he forwarded to me to try to solve the problem. 

Steps to a happy online experience

First: Do some research.
Check the readme that came with your version, or look at them online off the cpmfetch.fistfullofcode.com web site.  Then, try a search of the coppermine-gallery.net forums.  For fun, you could also do a google search.

Second: Make sure you have the latest version.
I tend to release versions as often as needed to fix bugs. Yours may have been fixed. Check the online readme file for the most recent changes.  If a new stable version is due out soon, you may be advised to move to a development version.

Third: Add this to the top of your php page (Warning: does not apply to cfimageget.php)
This will force your php installation to generate error messages. Servers suppress errors to different degrees.

Code: [Select]
<?php error_reporting(E_ALL); ini_set('display_errors',1); ?>
Things to include in a cry for help:

    * The Exact error message.  "I get an error about something..." - Copy and paste
    * What version of coppermine you are using
    * What version of CoppermineFetch you are using
    * A link to your website and gallery
    * A link to an example of the problem (if possible)
    * How computer savvy you are (newbie, intermediate, damn good)
    * What kind of web server you are running on (if known)
    * Include the code you are using.

Include anything that makes your situation unique.  Believe it or not, we do test the software - so when it breaks, sometimes it is because you are doing something we did not forsee (not bad, just not thought of).  These are most important to include:

Examples:
  • Bridiging
  • Different domains, gallery on one, cpmfetch on another
  • Modifications to cpg


Logged

Αndré

  • Administrator
  • Coppermine addict
  • ****
  • Country: de
  • Offline Offline
  • Gender: Male
  • Posts: 15764
Re: Zufallsbild in anycontent
« Reply #10 on: June 05, 2009, 08:30:33 am »

Hab mir die Doku jetzt so gut wie durchgelesen.

Ich habe beim Überfliegen das hier gefunden ::)
Logged

Hexo

  • Coppermine regular visitor
  • **
  • Offline Offline
  • Gender: Male
  • Posts: 62
Re: Zufallsbild in anycontent
« Reply #11 on: June 05, 2009, 12:50:37 pm »

Huhu.
Ich hab das hier überlesen: thumbnail version (thumb) statt intermediate size (int)
Teste das heute Abend mal, aber ich vermute mal, dass es genau das ist, was ich suche.....

Danke für den super Support hier!!!
Gruß

Αndré

  • Administrator
  • Coppermine addict
  • ****
  • Country: de
  • Offline Offline
  • Gender: Male
  • Posts: 15764
Re: Zufallsbild in anycontent
« Reply #12 on: June 05, 2009, 01:20:45 pm »

Quote
The default is to grab the thumbnail version (thumb)
du musst also irgendwo angegeben haben, dass du nicht das Thumbnail, sondern eine größere Version haben möchtest. Den Parameter "thumb" zu übergeben sollte aber nicht schaden ;)
Logged

Hexo

  • Coppermine regular visitor
  • **
  • Offline Offline
  • Gender: Male
  • Posts: 62
Re: Zufallsbild in anycontent
« Reply #13 on: June 06, 2009, 12:43:06 am »

Mit diesem Code klappt es :-)

Code: [Select]
include "./cpmfetch/cpmfetch.php";
       $objCpm = new cpm("./cpmfetch/cpmfetch_config.php");
       $options = array( 'imagesize' => 'thumb' );
       $objCpm->cpm_viewRandomMediaFromAlbum(1,1,44,$options);
       $objCpm->cpm_close();

Danke für die Hilfen!!

Gruß
Pages: [1]   Go Up
 

Page created in 0.171 seconds with 19 queries.