Skip to main content
17 votes
Accepted

Image asset url is not being output

So after looking through other craft websites to see how they where able to get images to work I discovered what I did wrong when setting up the asset source. The thing is though that the craft ...
matthew's user avatar
  • 333
12 votes

Image alignment and size in Redactor 2

No need for a plugin. Just add: "imageResizable": true, "imagePosition": true, to your chosen redactor config file i.e. (/craft/config/redactor/standard.json)
Rattikarl's user avatar
  • 393
8 votes
Accepted

Using Image Transform as another custom field

The imageTransform value is actually an object, representing the entire dropdown field. Update the first line to this... {% set imageTransform = storyEntry.storyThumbnailTransform.value %} This ...
Lindsey D's user avatar
  • 24k
7 votes

Output image in template

When you are working with an asset field you are actually looking at the object so you need to call {{asset.url}} in order to actually output the path to the image or whatever asset you are working ...
mcclaskiem's user avatar
7 votes
Accepted

Craft 3 image asset getUrl() not showing

The solution is to enable "assets for this source have public URLs" in the volume settings.
nmsdvid's user avatar
  • 305
5 votes

I am unable to correctly return the url of an uploaded asset

I found the answer in a similar post here: Image asset url is not being output My problem was with my Asset Source settings. Now that I think about it, it's obvious: I had no public URL declared for ...
Steven Thate's user avatar
5 votes
Accepted

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

Download the image into a temp file, then upload it as an asset. You can find $iAssetSourceId by looking at the URL when editing an asset source $iAssetSourceId = 4; $iAssetFolderId = (int)craft()-&...
michael's user avatar
  • 228
5 votes
Accepted

Images containing EXIF orientation tag are not rotated on upload

After some mail exchanges with Brad and Andris from Craft CMS, it turned out that there is an edge case where the image rotation on upload will not work if the EXIF extension is not installed (which ...
kant312's user avatar
  • 496
4 votes

Is there any way to prevent Craft from doing anything with uploaded GIF assets?

When you upload an image to Craft, the image is automatically “cleansed” using the same basic process that Craft uses to create image transforms. That happens to ensure that there are no malicious ...
Brandon Kelly's user avatar
4 votes
Accepted

Getting image for product in Cart Screen

This actually depends where the image is stored - if the asset (image) field is on the product, and is called myImage, then as per Brad's example you'd use: lineitem.purchasable.product.myImage ......
Jeremy Daalder's user avatar
4 votes

Redactor image caption not saved and formatting lost

I copied your Redactor settings to a clean installation of Craft (2.6.2945) and added an image to a Rich Text field set to use those specific settings. Initially I encountered the same behaviour. ...
Stephen Hamilton's user avatar
4 votes

Adding images directly to public folder

You need to use the Update Asset Indexes tool in Settings in the control panel: Whenever there are files within your asset source that were not added directly by Craft (e.g. via FTP), you will need ...
Marion Newlevant's user avatar
4 votes

404 Error showing for Asset Images

Figured it out. I assumed that my assets folder needed 744 just as the install instructions mentioned for the Craft CMS folders. But, I need to change the permissions to the standard 755. Once I did, ...
DevServe's user avatar
  • 303
4 votes

Using Focuspoint with eager loading

After some research I found out that this problem has no simple solution (unfortunately). Check https://github.com/smcyr/Craft-FocusPoint/issues/10. A solution would be not to use eager loading (...
Mr. Sam's user avatar
  • 287
4 votes
Accepted

Craft 3 Image quality is terrible after asset upload from admin panel

Converting my comment(s) into an answer... Make sure you are using the ImageMagick library to handle image manipulation (instead of the default GD library). It provides much better results. Craft ...
Lindsey D's user avatar
  • 24k
4 votes

How do I add Alt Image Tags to my photos?

Out of the box, you can use the image "Title" as alt text. Since it is already configured - you don't need to add any additional fields. Then you can output this in your twig template as: {% set ...
gjhead's user avatar
  • 123
3 votes
Accepted

Can't view image assets in web browser (403 error) after uploaded in Craft CMS Dashboard

Fixed the image issue. Such a simple oversite. I just needed to change the Asset Source settings and change the URL to include :8888 since I was running a local build with MAMP Pro.
egivensjr's user avatar
3 votes
Accepted

Is there any way to prevent Craft from doing anything with uploaded GIF assets?

Although this issue turned out to be the result of a bug, for the record you can bypass Craft's image processing step by manually uploading an image directly to the assets folder on the server (ie. ...
Nick F's user avatar
  • 1,215
3 votes

PHP transformed image?

$entry->featuredImage[0]->getUrl('small'); works.
Jamie's user avatar
  • 151
3 votes

Assets (images) return a 404 on the front-end

Just had a similar issue with a colleague. Double check your folder permissions. It might be the case that Craft isn’t allowed to write the transformed files to your assets folder. Something like ...
medoingthings's user avatar
3 votes

Global Image Variables?

This is a general structure to display global images in any template: <img src="{{ globalHandle.globalAssetHandle.one().getUrl }}" alt=""> You have to set your global handle ...
Alexis Dalai Waldo Jiménez's user avatar
3 votes

Load an asset at random each page load

Another way of getting a random image from image set in Craft 3 {{ shuffle(entry.bgImg.all())[0].getUrl('1900x1050') }}
denesis's user avatar
  • 109
3 votes

403 Forbidden Assets

This article will help you set permissions properly for Craft CMS installs: Hardening Craft CMS Permissions It leverages Craft-Scripts to do the heavy lifting.
andrew.welch's user avatar
  • 11.6k
3 votes

Image Transforms - Image not processed until second page refresh

I'm having this problem too. This can't be expected behaviour, can it? EDIT (SOLVED): I've learned from MildlyGeeky in the Craft Discord server that this issue is caused by Twig being picky about ...
user2157969's user avatar
3 votes

Upload Image Custom Field

I believe you are looking for the Assets Field
Ben Parizek's user avatar
  • 13.5k
3 votes
Accepted

Asset thumbs missing in control panel after Assets Source update

My basePath was wrong in my config (due to a DropBox syncing issues). Once I corrected that and cleared caches, the asset thumbs reappeared.
Matt Ellis's user avatar
3 votes

Asset thumbs missing in control panel after Assets Source update

Go to Settings > Clear Caches. Should regenerate them all from the new source.
darylknight's user avatar
  • 3,290
3 votes
Accepted

Image transforms not working properly

If I remember correctly, you will see urls similar to this http:\/\/mysite.dev\/cpresources\/404?x=CjvOQxsnA if you have generateTransformsBeforePageLoad as false. It could genuinely be the case that ...
joep's user avatar
  • 610
3 votes
Accepted

How can I insert images into a Redactor rich text field in a front-end form?

It doesn't seems possible natively, you should write a custom upload script. → Example #1 → Example #2 If it doesn't matter to add the images inside your rich text field, one more simple workaround ...
Romain P.'s user avatar
  • 1,852
3 votes
Accepted

Default Upload Location needs matrix field and entry info... How?

If your desired URL is: http://sitename.com/uploads/towns/town-slug/album-name/filename.jpg The the "Upload Location" for the setup you described would be something like: towns/{owner.slug}/{...
Brad Bell's user avatar
  • 67.5k

Only top scored, non community-wiki answers of a minimum length are eligible