Closed (fixed)
Project:
FileField
Version:
6.x-3.0-rc1
Component:
Documentation
Priority:
Normal
Category:
Support request
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
26 May 2009 at 10:51 UTC
Updated:
3 Jan 2014 at 00:29 UTC
Jump to comment: Most recent
Comments
Comment #1
quicksketchThere isn't any documentation that I'm aware of other than the inline PHPdoc. You can use the field_file_load() function to load a file by its FID, then look at the contents of the file.
However, for what you're wanting you don't even need filefield_meta.module at all, as you can easily get this information by using the image_get_info() function provided by core.
I'm not sure about where you'll actually be using this code though. You've asked about using tokens to display this information (indeed filefield_meta does provide tokens for all this information), but you don't say exactly what you're working with. What are you trying to accomplish?
Comment #2
ErwanF commentedThanks for your reply. This is an example of what I would like to accomplish: Just after uploading a JPEG image, this image would be made downloadable by clicking on the following text, created "on the fly" by the system: [width] x [height] ([weight]). Ex: "800x600 pixels (2000 Ko)".
Comment #3
quicksketchSo this is while the user is still on the node/x/edit or node/add/x page and not when viewing the created piece of content? You want this below the thumbnail preview (in ImageField) or somewhere else? Perhaps a mockup/screenshot would clarify all of this for me. Depending on where you want to show this link, it'll change what the answer is.
Comment #4
ErwanF commentedI don't need any thumbnail there, only a "simple" text link. And the text is made of some of the image properties. The idea is to build the hypertext link while the image is uploaded (or immediately after). One could see this link directly on the node/x/edit page then on the node/x page. Instead of having a link made on the name of the image (grabbed from the name of the jpeg file for instance; this is already easily achievable), the link is made of some image properties like width, height, weight... and link to the newly uploaded image file.
Comment #5
quicksketchGotcha, fortunately both these places are themed in the same place (as long as you're using the "Generic files" display formatter).
You can do this with the following:
- Open the filefield_formatter.inc file
- Copy the entire "theme_filefield_file" function to your theme's template.php file.
- Rename the function to [name_of_your_theme]_filefield_file()
- Clear the Drupal cache at admin/settings/performance (click the "Clear all Caches" button at the bottom).
- Modify the function to include height and width information.
You can get the height and width information by using the following:
Add this just before the
return '<div class="filefield-file clear-block">'. $icon . l($link_text, $url, $options) .'</div>';line.Comment #6
ErwanF commentedWow, thanks for this detailed answer, quicksketch, I'll try this as soon as possible.
Comment #7
quicksketch