Somebody can correct me, but:

$title = Title::makeTitle( NS_FILE, $filename );
$file = wfLocalFile( $title );
$file->getUrl();
// $file->getFullUrl();
// ...


*-- *
*Tyler Romeo*
Stevens Institute of Technology, Class of 2016
Major in Computer Science

On Mon, Jan 19, 2015 at 1:45 PM, Jeroen De Dauw <[email protected]>
wrote:

> Hey,
>
> On my local wiki I have a page with the name "File:Blue marker.png". The
> following code returns false:
>
> $title = Title::makeTitle( NS_FILE, $file );
> $title->exists();
>
> That used to return true in the past. Not sure what is broken - my wiki or
> MediaWiki itself.
>
> What I want to do is go from string page name, such as "File:Blue
> marker.png", to full URL, such as "
> http://localhost/phase3/images/6/6f/Blue_marker.png";. What is the
> recommended way of doing this now (that works on MW 1.19 and later)?
>
> Cheers
>
> --
> Jeroen De Dauw - http://www.bn2vs.com
> Software craftsmanship advocate
> Evil software architect at Wikimedia Germany
> ~=[,,_,,]:3
> _______________________________________________
> Wikitech-l mailing list
> [email protected]
> https://lists.wikimedia.org/mailman/listinfo/wikitech-l
_______________________________________________
Wikitech-l mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/wikitech-l

Reply via email to