Votre question

Problème script flickrhelpr

Tags :
  • Script
  • Programmation
Dernière réponse : dans Programmation
23 Septembre 2009 15:16:28


j'aimerai installer ce script : http://www.supersimple.org/flickrhelpr
sur mon site.
Donc j'ai télécharger le script ensuite j'ai créer un compte sur flickr, puis j'ai modifié la page global.php pour mettre l'api_key....etc

ensuite comme j'ai lu dans le read_me j'ai mis sur ma page ou je voulais ma galerie

  1. <?php
  3. include("$ f = phpFlickr new ();");
  4. ?>

et voila ce que j'ai :

Warning: include($ f = phpFlickr new ();) [function.include]: failed to open stream: No such file or directory in /www/backtographics/essai/packdisponiblesites.php on line 12

Warning: include() [function.include]: Failed opening '$ f = phpFlickr new ();' for inclusion (include_path='.:/usr/share/php:/usr/share/pear') in /www/backtographics/essai/packdisponiblesites.php on line 12

ma page globlas.php :

  1. <?php
  3. $PAGE_TITLE = 'FLICKR photos'; #this is the page title that you want to use for your photo gallery
  4. $BASEURL = '<a href="http://mydomain.com/photos" rel="nofollow" target="_blank">http://mydomain.com/photos</a>'; #this is the URL for your photo gallery - eg. '<a href="http://mydomain.com/photos" rel="nofollow" target="_blank">http://mydomain.com/photos</a>' - (no trailing slash)
  6. //Set dimensions of the images on the homepage
  7. $INDEXTHUMB = array();
  8. $INDEXTHUMB['width'] = 180; //integers only, do not include 'px' at the end
  9. $INDEXTHUMB['height'] = 150; //integers only, do not include 'px' at the end
  11. //Set dimensions of the thumbnails on the photoset page
  12. $INNERTHUMB = array();
  13. $INNERTHUMB['width'] = 32; //integers only, do not include 'px' at the end
  14. $INNERTHUMB['height'] = 32; //integers only, do not include 'px' at the end
  16. //Set the number of columns of thumbnails to show on the photoset page
  17. $THUMBCOLS = 5;
  19. //Set the number of rows of thumbnails to show on the photoset page
  20. $THUMBROWS = 5;
  22. //set size of the feature photo - only choices are 'square', 'small', 'medium', 'large'
  23. $FEATUREIMAGE = 'medium';
  27. # <a href="http://www.flickr.com/services/api/" rel="nofollow" target="_blank">http://www.flickr.com/services/api/</a> - to signup for an API key - it is easy!
  29. $FLICKR = array();
  31. $FLICKR['api_key'] = 'mon api'; #this is your key
  32. $FLICKR['secret'] = 'mon code secret'; #this is your secret (comes with your API key)
  33. $FLICKR['username'] = 'monmotdepass'; #this is your flickr account username. When you sign in, it says "welcome USERNAME", "Konnichi Wa USERNAME", "Bonjour, USERNAME", etc.
  35. ?>

voila le read_me en anglais :


Written by TR1 Design for supersimple.org


Released: 05/07/2007

Changes since version 1.0:

- setup in globals.php now requires username rather than usercode.
This chabge was made
due to the number of users that have a custom flickr URL and cannot find their usercode.


FlickrHelpr is a script that allows a user to display their Flickr™ photos on their own webpage.

It will display the primary photo from each photo set on the index page, each of which link
to the photoset page. The photoset page shows all of the photos in that set.

To install the script, just:
1. upload all files onto your server.
2. go to http://www.flickr.com/services/api/ and get an API key (they're free)
3. set the constants in globals.php


About globals.php

This file contains required information, like your API key and secret, and also some preferences.
Each constant is commented to detail its purpose.


License for FlickrHelpr


FlickrHelpr was written by Todd Resudek (todd@tr1design.net) for supersimple.org

Released under GNU Lesser General Public License (http://www.gnu.org/copyleft/lgpl.html)
For more information about the class and upcoming tools and applications using it,
visit http://www.phpflickr.com/ or http://www.sourceforge.net/projects/phpflickr/

If you are interested in hiring me for a project please email me.


License for phpFlickr Class


phpFlickr Class 2.1.0
Written by Dan Coulter (dancoulter@users.sourceforge.net)
Project Homepage: http://www.phpflickr.com/
Sourceforge Project Page: http://www.sourceforge.net/projects/phpflickr/
Released under GNU Lesser General Public License (http://www.gnu.org/copyleft/lgpl.html)
For more information about the class and upcoming tools and applications using it,
visit http://www.phpflickr.com/ or http://www.sourceforge.net/projects/phpflickr/

If you are interested in hiring me for a project (involving phpFlickr
or not), feel free to email me.

Installation instructions:
1. Copy the files from the installation package into a folder on your
server. They need to be readible by your web server. You can put
them into an include folder defined in your php.ini file, if you
like, though it's not required.

2. All you have to do now is include the file in your PHP scripts and
create an instance. For example:
$f = new phpFlickr();

The constructor has three arguments:
A. $api_key - This is the API key given to you by flickr.com. This
argument is required and you can get an API Key at:

B. $secret - The "secret" is optional because is not required to
make unauthenticated calls, but is absolutely required for the
new authentication API (see Authentication section below). You
will get one assigned alongside your api key.

C. $die_on_error - This takes a boolean value and determines
whether the class will die (aka cease operation) if the API
returns an error statement. It defaults to false. Every method
will return false if the API returns an error. You can access
error messages using the getErrorCode() and getErrorMsg()

3. All of the API methods have been implemented in my class. You can
see a full list and documentation here:
To call a method, remove the "flickr." part of the name and replace
any periods with underscores. For example, instead of
flickr.photos.search, you would call $f->photos_search() or instead
of flickr.photos.licenses.getInfo, you would call
$f->photos_licenses_getInfo() (yes, it is case sensitive).

All functions have their arguments implemented in the list order on
their documentation page (a link to which is included with each
method in the phpFlickr clasS). The only exceptions to this are
photos_search(), photos_getWithoutGeodata() and
photos_getWithoutGeodata() which have so many optional arguments
that it's easier for everyone if you just have to pass an
associative array of arguments. See the comment in the
photos_search() definition in phpFlickr.php for more information.

As of this release of the phpFlickr class there is only one authentication method
available to the API. This method is somewhat complex, but is far more secure and
allows your users to feel a little safer authenticating to your application. You'll
no longer have to ask for their username and password.

Authentication API - http://www.flickr.com/services/api/auth.spec.html

I know how complicated this API looks at first glance, so I've tried to
make this as transparent to the coding process. I'll go through the steps
you'll need to use this. Both the auth.php and getToken.php file will
need your API Key and Secret entered before you can use them.

To have end users authenticate their accounts:
First, setup a callback script. I've included a callback script that
is pretty flexible. You'll find it in the package entitled "auth.php".
You'll need to go to flickr and point your api key to this file as the
callback script. Once you've done this, on any page that you want to
require the end user end user to authenticate their flickr account to
your app, just call the phpFlickr::auth() function with whatever
permission you need to use.
For example:
The three permissions are "read", "write" and "delete". The function
defaults to "read", if you leave it blank.

Calling this function will send the user's browser to Flickr's page to
authenticate to your app. Once they have logged in, it will bounce
them back to your callback script which will redirect back to the
original page that you called the auth() function from after setting
a session variable to save their authentication token. If that session
variable exists, calling the auth() function will return the permissions
that the user granted your app on the Flickr page instead of redirecting
to an external page.

To authenticate the app to your account to show your private pictures (for example)
This method will allow you to have the app authenticate to one specific
account, no matter who views your website. This is useful to display
private photos or photosets (among other things).

*Note*: The method below is a little hard to understand, so I've setup a tool
to help you through this: http://www.phpflickr.com/tools/auth/.

First, you'll have to setup a callback script with Flickr. Once you've
done that, edit line 12 of the included getToken.php file to reflect
which permissions you'll need for the app. Then browse to the page.
Once you've authorized the app with Flickr, it'll send you back to that
page which will give you a token which will look something like this:
Go to the file where you are creating an instance of phpFlickr (I suggest
an include file) and after you've created it set the token to use:
$f->setToken("<token string>");
This token never expires, so you don't have to worry about having to
login periodically.

Using Caching:
Caching can be very important to a project. Just a few calls to the Flickr API
can take long enough to bore your average web user (depending on the calls you
are making). I've built in caching that will access either a database or files
in your filesystem. To enable caching, use the phpFlickr::enableCache() function.
This function requires at least two arguments. The first will be the type of
cache you're using (either "db" or "fs")

1. If you're using database caching, you'll need to supply a PEAR::D B connection
string. For example:
$flickr->enableCache("db", "mysql://user:p assword@server/database");
The third (optional) argument is expiration of the cache in seconds (defaults
to 600). The fourth (optional) argument is the table where you want to store
the cache. This defaults to flickr_cache and will attempt to create the table
if it does not already exist.

2. If you're using filesystem caching, you'll need to supply a folder where the
web server has write access. For example:
$flickr->enableCache("fs", "/var/www/phpFlickrCache");
The third (optional) argument is, the same as in the Database caching, an
expiration in seconds for the cache.
Note: filesystem caching will probably be slower than database caching. I
haven't done any tests of this, but if you get large amounts of calls, the
process of cleaning out old calls may get hard on your server.

You may not want to allow the world to view the files that are created during
caching. If you want to hide this information, either make sure that your
permissions are set correctly, or disable the webserver from displaying
*.cache files. In Apache, you can specify this in the configuration files
or in a .htaccess file with the following directives:

<FilesMatch "\.cache$">
Deny from all

Alternatively, you can specify a directory that is outside of the web server's
document root.

Uploading is pretty simple. Aside from being authenticated (see Authentication
section) the very minimum that you'll have to pass is a path to an image file on
your php server. You can do either synchronous or asynchronous uploading as follows:
synchronous: sync_upload("photo.jpg");
asynchronous: async_upload("photo.jpg");

The basic difference is that synchronous uploading waits around until Flickr
processes the photo and returns a PhotoID. Asynchronous just uploads the
picture and gets a "ticketid" that you can use to check on the status of your
upload. Asynchronous is much faster, though the photoid won't be instantly
available for you. You can read more about asynchronous uploading here:

Both of the functions take the same arguments which are:
Photo: The path of the file to upload.
Title: The title of the photo.
Description: A description of the photo. May contain some limited HTML.
Tags: A space-separated list of tags to apply to the photo.
is_public: Set to 0 for no, 1 for yes.
is_friend: Set to 0 for no, 1 for yes.
is_family: Set to 0 for no, 1 for yes.

Replacing Photos
Flickr has released API support for uploading a replacement photo. To use this
new method, just use the "replace" function in phpFlickr. You'll be required
to pass the file name and Flickr's photo ID. You need to authenticate your script
with "write" permissions before you can replace a photo. The arguments are:
Photo: The path of the file to upload.
Photo ID: The numeric Flickr ID of the photo you want to replace.
Async (optional): Set to 0 for a synchronous call, 1 for asynchronous.
If you use the asynchronous call, it will return a ticketid instead
of photoid.

Other Notes:
1. Many of the methods have optional arguments. For these, I have implemented
them in the same order that the Flickr API documentation lists them. PHP
allows for optional arguments in function calls, but if you want to use the
third optional argument, you have to fill in the others to the left first.
You can use the "NULL" value (without quotes) in the place of an actual
argument. For example:
$f->groups_pools_getPhotos($group_id, NULL, NULL, 10);
This will get the first ten photos from a specific group's pool. If you look
at the documentation, you will see that there is another argument, "page". I've
left it off because it appears after "per_page".
2. Some people will need to ues phpFlickr from behind a proxy server. I've
implemented a method that will allow you to use an HTTP proxy for all of your
traffic. Let's say that you have a proxy server on your local server running
at port 8181. This is the code you would use:
$f = new phpFlickr("[api key]");
$f->setProxy("localhost", "8181");
After that, all of your calls will be automatically made through your proxy server.
3. NOTE: phpFlickr's support of 23's API is only supported in 1.x
versions of phpFlickr. This will not work in 2.x until they
begin using serialized PHP. Don't even try!
As of phpFlickr version 1.5, I've decided to add support for 23's API. The
reasoning behind this is that 23 (a European-based photo sharing community)
has released an API based on Flickr's. Their main reason for doing so seems
to be compatibility for developers. This means that your app may instantly
start working for their users as well. All you'll need to do to get phpFlickr
to work with 23 is to use the following code:
$f = new phpFlickr("[api key]"); //With 23's API, you can make up your own API
//key or use one assigned to you from Flickr
To change back to flickr (the default setting):
I'm including this support with a few caveats:
-Currently, I'm only willing to support 23 insofar as they duplicate the
functionality of Flickr. If they begin to stray, create new methods, or
implement their own authentication scheme, I may end support of their
API at my discretion.
-There are some differences between the services. Their "square" thumbnail
format is larger than Flickr's. Also the photo page URLs have a different
format than Flickr's. I haven't used 23 much myself, so there may be
other important differences that I don't know about.
-Not all of Flickr's API methods have been implemented by 23. As far as I
can tell, they have setup dummy methods that will return empty result sets.
-According to their documentation, 23 does not yet support the "web application"
style authentication that Flickr does. This means that your app will not
authenticate to 23 as it would to Flickr.
More information about 23 and their API:
Homepage: http://www.23hq.com/
About 23: http://www.23hq.com/23/about
Switching from Flickr's API: http://www.23hq.com/doc/api/switch
API Documentation: http://www.23hq.com/doc/api/index
Terms of Service: http://www.23hq.com/23/terms

That's it! Enjoy the class. Check out the project page (listed above) for updates
and news. I plan to implement file uploads and functions to aggregate data from
several different methods for easier use in a web application. Thanks for your
interest in this project!

Please email me or submit all problems or questions to the Help topic on
the phpFlickr forums:

je pense que j'ai fait une erreur pour l'inclusion mais je ne sais pas du tout comment m'y prendre j'aimerais la méme présentation que sur le site de l'auteur et je ne trouve pas de tutoriel sur internet
merci pour votre aide

Autres pages sur : probleme script flickrhelpr

23 Septembre 2009 20:34:00

Ah oui, en effet tu ne sais pas bien faire un copier/coller.

Désolé je te laisse chercher un peu plus avant de donner la solution ;)  Car c'est vraiment trop simple.
25 Septembre 2009 09:27:35

a oui en effet je vais voir si ca marche :( 

edit : non ca ne marche toujours pas méme en faisant un vrai copié-collé

j'ai toujours :

Warning: include( = new phpFlickr(); ) [function.include]: failed to open stream: No such file or directory in /www/backtographics/essai/packdisponiblesites.php on line 12

Warning: include() [function.include]: Failed opening ' = new phpFlickr(); ' for inclusion (include_path='.:/usr/share/php:/usr/share/pear') in /www/backtographics/essai/packdisponiblesites.php on line 12
Contenus similaires
25 Septembre 2009 11:14:47

Au final tu n'as absolument rien corrigé ou alors tu n'y connais vraiment rien au PHP.


il faut que tu fasses un :

  1. include('lechemin/vers/les/sources/contenant/phpFlickr.php');
  2. $f = new phpFlickr();
25 Septembre 2009 11:22:43

non je n'y connais rien dsl mais ca ne marche toujours pas voici mon code :

  1. <?php
  3. include ('flickr/phpFlickr.php');
  4. "$f = new phpFlickr(); "
  5. ?>

edit : j'ai vu que c'était phpFlickr.php mais j'ai une page vide...
25 Septembre 2009 18:03:09

pourquoi mettre des " en ligne 4 ?
26 Septembre 2009 00:18:38

mercii j'ai réctifie mais ca ne marche toujours pas :( 
pourtant j'ai vérifié dans la page globlas.php si j'avais pas oublié quelques choses mais normalement je n'ai rien oublié. voila ce que j'ai sur ma page :

Warning: Missing argument 1 for phpFlickr::p hpFlickr(), called in /www/backtographics/packdisponiblesites.php on line 13 and defined in /www/backtographics/flickr/phpFlickr.php on line 76

Warning: phpFlickr::require_once(HTTP/Request.php) [function.phpFlickr-require-once]: failed to open stream: No such file or directory in /www/backtographics/flickr/phpFlickr.php on line 90

Fatal error: phpFlickr::require_once() [function.require]: Failed opening required 'HTTP/Request.php' (include_path='.:/usr/share/php:/usr/share/pear') in /www/backtographics/flickr/phpFlickr.php on line 90
Tom's guide dans le monde
  • Allemagne
  • Italie
  • Irlande
  • Royaume Uni
  • Etats Unis
Suivre Tom's Guide
Inscrivez-vous à la Newsletter
  • ajouter à twitter
  • ajouter à facebook
  • ajouter un flux RSS