We’re rewarding the question askers & reputations are being recalculated! Read more.

Questions tagged [assetfilemodel]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
2
votes
2answers
267 views

Uploading an Asset from a custom CP-Tab in Craft 2.x

I have been looking through answers here at stackexchange but somehow can't figure out what i am missing. I simply want to upload an asset to a specific asset folder in my plugin. I do get an error: ...
1
vote
2answers
56 views

Error when outputting assets from a field within a Neo field

Anyone with Neo experience had issues with outputting an assets field with multiple images? I am not using a dynamic field, as I saw there are issues with that. Code {% for asset in block....
1
vote
2answers
332 views

How can I base64-encode an Image Transform?

I'm trying to use this plugin, but it requires an AssetFileModel as input. I can pass it the asset in question, no problem, but I'm wanting to pass it a transformed version of the asset. However, it ...
3
votes
1answer
2k views

Object of class Craft\ElementCriteriaModel could not be converted to string

I have set up a Matrix field that contains a block type that contains among other things, an asset field. Trying to iterate through the contents of that matrix field works just fine for all other ...
1
vote
1answer
564 views

List subfolders of a specific asset folder

Is it possible to list subfolders from a specific folder? Context: I'm printing out hundreds of icons which are maintained by moving a directory structure directly over to my public assets folder. ...
2
votes
1answer
256 views

File upload error in MS Azure after custom domain was pointed to Azure server

I am facing an issue with file uploads. I installed a new installation of Craft CMS on Microsoft Azure server. MS Azure assigns a default domain to your webapp like example.azurewebsites.net. So ...
1
vote
2answers
712 views

What is the proper way to set an asset's upload location using the slugs/ structure path of the entry it is selected from?

I'm working on a site with a structure containing products that are nested within "category"(not actually using craft's categories, just an entry type) pages. On each category or sub-category page I ...
1
vote
1answer
106 views

How to retrieve the mode of an image transformation from its name?

I work on a portfolio with a large number of images with very high sizes and a lot of images transforms. The server on which this site is hosted reach these limits (images generations process are ...
1
vote
1answer
313 views

Get all images from a section

I want to get all images from the section projekte which are bound to the asset field bild I then want to fiddle around with .limit() and maybe random filters. So I grabbed all images like described ...
1
vote
1answer
116 views

Next/Previous Asset or Image within Entry

I'm looking to create a way to navigate to the next/previous image in an entry's asset range and display only the current asset at one time(starting from first asset). {% extends '_layout.html' %} {%...
5
votes
1answer
600 views

How to set a field of an asset from within a plugin

I am using the following code to save an asset that has been downloaded to the storage/runtime/temp directory from an external API $response = craft()->assets->insertFileByLocalPath( $...
1
vote
1answer
625 views

Is it possible to create a new asset from an image URL?

I've created several entries from a feed from the eBay API, but I would like to add images to the entry too! I've managed to get an array of URLs, which I would like to import into an assets field ...
2
votes
1answer
156 views

Send an asset from a plugin controller

I have a controller which fetches an asset from an entry (this is the service method that provides the asset): public function findPoster($entryId) { $criteria = craft()->elements->...
0
votes
1answer
244 views

CBdException: Column 'id' cannot be null

I receive the following error only when I clear the cache: When I try to rebuild the image index, all of my image paths go missing. I'm not sure what caused this error but I do need to fix it. I've ...
1
vote
0answers
58 views

User Group specific asset paths

I've been doing some quite involved work on a site where we want to restrict user access to certain asset paths. Following the post at Assets Folder: Images don't show up I was directed to the ...
1
vote
1answer
233 views

File input attachment format for Contact Form plugin

Is it possible to specify the file formats for an upload field with the Contact Form? Is it controlled by the extraAllowedFileExtensions setting?
2
votes
1answer
129 views

Accessing the attributes of an Asset field

Specifically looking at these attributes http://d.pr/i/1ilbr I can access Alt text by {{ entry.assetHandle.first().altText }} and similarly can do {{ entry.assetHandle.first().sourceUrl }} but Source ...
14
votes
2answers
3k views

How to get absolute path to asset file?

I have some csv files uploaded as assets and now I need to fopen() them from my plugin. I have an AssetFileModel but I have not been able to work out how to construct a full path to the file. I can ...
1
vote
1answer
464 views

Image asset URI returning null

I have entries that contain a single graphic asset. I'm trying to use the graphic as a background image in my template. However, I'm unable to output the URI for the asset. I'm using entry.graphic....
1
vote
1answer
298 views

Can visitors 'force download' images stored on Amazon S3?

I have a large set of images, stored on Amazon S3. I would like my users to be able to download the original version of an image, rather then watching it in the browser. I know I can do this with PHP ...
3
votes
1answer
164 views

Management of large number of downloadable PDFs

I'm rebuilding the main website for a small rural local council, and at this stage I am planning on using Craft. The main issue I have is around the management of several hundred PDF documents which ...
2
votes
1answer
99 views

How can I get a related Asset of a specific field?

I'm trying to grab an Asset which is a child of my Entry... $criteria = craft()->elements->getCriteria(ElementType::Asset); $criteria->childOf = $entryId; $photo = craft()->assets->...
9
votes
1answer
2k views

How do you delete assets from a frontend form?

I am creating a proof of concept for a client in Craft where the client's customers can manage projects from the frontend of a Craft install. I have a frontend form working correctly for creating a ...
3
votes
1answer
966 views

How do I display a list of assets with the entries they are related to?

Given a list of assets, for each asset, how do I display a list of entries that relate to this asset? So, for instance, if asset A is selected as asset in entries 1 and 2, I want a list to be ...
2
votes
1answer
305 views

Is there a 'slug' for assets?

I'm trying to create a site with a gallery, and am investigating the possibility of getting Craft to treat an asset as an entry so I can display a detail page for an image without having to create an ...
8
votes
1answer
632 views

Is it possible to hook into image transforms?

I have a somewhat unique thumbnail need for a certain site. I need to watermark images with custom text (per image, not globally across the site). Is there a way to hook into the Craft image transform ...
4
votes
1answer
312 views

Better way to find a specific asset?

I'm currently using a route to get a specific asset for a gallery section of my site. URL is similiar to http://craft.dev/place/place-name/gallery/1 (Where 1 is the number in the gallery.) I'm ...