Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Gallery format / Format overlay makes too many requests to get image link #193

Open
nischayn22 opened this issue Mar 1, 2017 · 2 comments

Comments

@nischayn22
Copy link
Member

nischayn22 commented Mar 1, 2017

The overlay feature in gallery format makes n number of requests for each image to the server to get the actual URL of the image in client side. This can be done in server side much easily using something like this:

	$file = wfFindFile( $title );

	if ( !$file || !$file->exists() ) {
		return null;
	}
	// Default behavior: Use the direct link to the file.
	$url = $file->getUrl();

The $url can be passed to add() method as the third parameter.

	/**
	 * Add an image to the gallery.
	 *
	 * @param Title $title Title object of the image that is added to the gallery
	 * @param string $html Additional HTML text to be shown. The name and size
	 *   of the image are always shown.
	 * @param string $alt Alt text for the image
	 * @param string $link Override image link (optional)
	 * @param array $handlerOpts Array of options for image handler (aka page number)
	 */
	function add( $title, $html = '', $alt = '', $link = '', $handlerOpts = [] ) {

I will be shortly testing this and if possible submit a fix. But just wanted to note this here so if anyone else comes across this finds it.

@kghbln kghbln changed the title Format overlay makes too many requests to get image link Gallery format / Format overlay makes too many requests to get image link Mar 1, 2017
@nischayn22
Copy link
Member Author

I tested this and my analysis is correct that we are making a lot of unnecessary calls. But I am not sure how we want to proceed about this as we are also using the File:xyz.jpg link for the overlay icon.

Can someone using this feature or actively working on it suggest?

@nischayn22
Copy link
Member Author

I am now using this in #194

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants