5.7.4.2 - How to find things? - Files/Images

Permalink
This is a bit of a different question. Basically it's very time consuming and annoying for me trying to find out how to do things in 5.7. There was much more documentation in 5.6 and I could get around stuff. But in 5.7 it's really hard to find some basic things.

And I hope that maybe someone can point me in the right directions how to make this process of finding information in 5.7 faster and less time consuming.

Actual example:

I try to find out how to display an thumbnail image in 5.7. In 5.6 I just checked the documentation on concret5.org for the image and file helper and everything was there. Easy.
In 5.7 I googled, looked in the forums, tried to find something in the documentation.... until I finally found one good source of information here:

http://www.webli.us/cheatsheet/doku.php...

Should have used this site from the start as it did help me the most so far when looking for information. So now I was able to echo out my thumbnail image.

But I still don't know how to get the name of the file. I mean I have the file object and it can't be that hard to get the file name. I can even read it if I print_r the object.
But I can't find anything about it in the forums or anywhere else.

What method gives me the file name? Do I need to use something by the images or by the files?

Sure, I have the Conrete5 APIhttp://concrete5.org/api/index.html... and maybe it's somewhere in there. But where? I'm sure there is a logic in there, but I don't see it. Maybe someone can tell me the correct approach so I can find this things myself without spamming the forum with questions.

Many thanks.

 
MrKDilkington replied on at Permalink Reply
MrKDilkington
Hi Kiesel,

This will get the file name from a file object.
$file = File::getByID($fID);
echo $file->getFileName();

For developers, I cannot stress how useful the ExchangeCore Developer Tools add-on is.
https://www.concrete5.org/marketplace/addons/exchangecore-developer-...

Even if you aren't using PhpStorm, the __IDE_SYMBOLS__.php file the add-on generates is a great resource. It is a giant list of concrete5 methods and their classes. Methods in concrete5 are named after what they do. If you need to get a file name, search through __IDE_SYMBOLS__.php for "name" and you will quickly find the method you are looking for.

The other really helpful feature of the add-on is the services list it generates. Services are for 5.7 what helpers were for 5.6. When you see Core::make(something), that is a service. Reading through the services list, you might easily find things you have never seen before, but could easily find a use for. It also tells you what class the service uses and has a link to the concrete5 API for that class. This makes it very easy to find all the methods available for that service.

While waiting for more documentation, I've learned a lot by reading through the API, looking through concrete5 files, and downloading all the free 5.7 blocks and looking at how they are made.