Announcement

  •  » Extensions
  •  » Embed Piwigo photos in WordPress

#1 2018-08-13 10:19:34

samwilson
Member
Fremantle, Western Australia
2014-02-06
42

Embed Piwigo photos in WordPress

Hi,

Anyone here using WordPress to blog in conjunction with storing photos in Piwigo? I am, and one thing I have liked about Flickr in the past is the ease with which one can add photos to WordPress posts: you just paste a URL on it's own line, and it's rendered as a medium-sized image with title and link. For a while I've been wanting to be able to do this with my photos on Piwigo, and so I've made this WordPress plugin:

https://github.com/samwilson/embed-piwigo

I know there is PiwigoPress (and the older PiwigoMedia), but I never need their complexity (to browse the photos I want to include in a blog post, I just use Piwigo directly). My plugin isn't at all a replacement for PiwigoPress, though — it's just a much simpler and smaller thing that does one thing.

Anyway, I thought I'd post it here in case anyone's interested. I've not created a page for it on wordpress.org yet (am intending to add caching for the API calls first), so for now it has to be installed manually (which I reckon people should be doing anyway, so the web server user doesn't have to have access to write PHP files).

Thanks,
Sam.

Last edited by samwilson (2018-08-15 11:20:55)

Offline

 

#2 2018-08-14 06:22:36

executive
Member
2017-08-16
1214

Re: Embed Piwigo photos in WordPress

Cool. I've got a Wordpress site so I may have a use for this in the future.
Do you have a demo or screenshots?

Offline

 

#3 2018-08-15 11:16:45

samwilson
Member
Fremantle, Western Australia
2014-02-06
42

Re: Embed Piwigo photos in WordPress

Yup! It's now available for download from the WordPress plugin directory:

https://wordpress.org/plugins/embed-piwigo/

And it looks like this in the admin area:

https://piwigo.org/forum/showimage.php?pid=171433&filename=embed-piwigo.png

And this when an image is being viewed (although of course it is completely up to the theme as to how it gets displayed):

https://piwigo.org/forum/showimage.php?pid=171433&filename=embed-piwigo-output.png

I'm totally keen for any feedback about how it works, especially about what info should be put in the caption text (at the moment it's just the image title, and the description is the tooltip text, but perhaps the date(s), tags, etc. could be added there, or number of comments, or anything really).

Last edited by samwilson (2018-08-15 11:19:57)

Offline

 

#4 2018-08-15 14:13:05

drlecter
Member
2016-03-17
21

Re: Embed Piwigo photos in WordPress

It looks here nice. I try to test the Plugin the next Days. I write my Travelblog and need my Images from the Gallery.

Offline

 

#5 2018-09-05 21:24:35

drlecter
Member
2016-03-17
21

Re: Embed Piwigo photos in WordPress

Hi,

i installed the Plugin and it looks good. It is possible to change the Preview Size to Thumbnail or so?

Offline

 

#6 2019-12-03 01:31:13

michaelh99
Member
Texas
2014-08-19
46

Re: Embed Piwigo photos in WordPress

Any news from the last year?

Offline

 

#7 2019-12-03 02:41:57

samwilson
Member
Fremantle, Western Australia
2014-02-06
42

Re: Embed Piwigo photos in WordPress

michaelh99 wrote:

Any news from the last year?

Not much has changed with the plugin. It continues to work. Now that WordPress has moved to a new editor (the block-editor, or Gutenberg), a different system might be in order, but I don't plan on changing this plugin to be anything more fancy than a basic old-fashioned embed. Pull requests are always welcome though!

Offline

 

#8 2023-06-16 04:32:50

michaelh99
Member
Texas
2014-08-19
46

Re: Embed Piwigo photos in WordPress

It would appear the plugin no longer works?  I'm completely unable to embed images from

https://www.dragonseye.com/photos/pictu … /1132-barn

into wordpress 6.2.2

Offline

 

#9 2023-06-16 12:14:50

gueba
Member
2021-12-31
55

Re: Embed Piwigo photos in WordPress

michaelh99 wrote:

It would appear the plugin no longer works? ...

Are you on PHP 8.x? If so, I have a quick and dirty solution:

In "yourwordpress/wp-content/plugins/piwigopress/piwigopress_utils.php" at line 7 replace:

Code:

function PWGP_secure($data) {
    if ( get_magic_quotes_gpc() ) return urldecode ( trim ( htmlentities ( stripslashes( trim($data) ) , ENT_NOQUOTES ) ) );
    else return urldecode ( trim ( htmlentities ( trim($data) , ENT_NOQUOTES ) ) );
}

with:

Code:

 function PWGP_secure($data) {
//  if ( get_magic_quotes_gpc() ) return urldecode ( trim ( htmlentities ( stripslashes( trim($data) ) , ENT_NOQUOTES ) ) );
//  else return urldecode ( trim ( htmlentities ( trim($data) , ENT_NOQUOTES ) ) );
return urldecode ( trim ( htmlentities ( stripslashes( trim($data) ) , ENT_NOQUOTES ) ) );
//   return urldecode ( trim ( htmlentities ( trim($data) , ENT_NOQUOTES ) ) );
}

Hint: the function "get_magic_quotes_gpc() " no longer exists in PHP8. This causes a Fatal Error.


I could insert pictures from "https://www.dragonseye.com/photos/" in a Wordpress 6.2.2 running on PHP 8.1

hth

Offline

 

#10 2023-06-16 17:14:03

michaelh99
Member
Texas
2014-08-19
46

Re: Embed Piwigo photos in WordPress

I'm actually on 7.4 but will try updating and also try the code changes you posted.
Thank you!

Offline

 

#11 2023-06-17 11:25:51

gueba
Member
2021-12-31
55

Re: Embed Piwigo photos in WordPress

The code affects only php8 (should work in 7 though).
You should describe in detail, where the problem appears.
You must use the 'old' clasic editor.
If you set 'https://www.dragonseye.com/photos/' as your gallery url, can you see and chose your albums?
Can you load and see the first five pics - you may not be able to draw a picture from here to your dropping zone.
If you can 'get more pics' (10) click it should work.

good luck

Offline

 

#12 2023-06-17 21:53:43

michaelh99
Member
Texas
2014-08-19
46

Re: Embed Piwigo photos in WordPress

I think I'll probably wait on this.  If I have to use the old editor, that's kind of a deal breaker since I have since figured out that while "embedding" doesn't work natively, I can add an image from a URL which does most of what I need.

Offline

 
  •  » Extensions
  •  » Embed Piwigo photos in WordPress

Board footer

Powered by FluxBB

github twitter newsletter Donate Piwigo.org © 2002-2024 · Contact