Skip to main content
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
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
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

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

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

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
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
  • 24.1k
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

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
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,917
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.6k
3 votes
Accepted

Random transforms

You can use Twigs Random function {{ random(['masonryLarge', 'masonryMedium', 'masonrySmall']) }} So you could do something like {% for entry in craft.entries.section('news').limit(10).all() %} ...
Robin Schambach's user avatar
3 votes
Accepted

block.image.one() shows more than one image

Yes you're correct, one() will get the first matching element. However, in your code you're not asking for the first image block, but rather the first image from each image block (because each image ...
Jalen Davenport's user avatar
  • 3,045
3 votes
Accepted

Commerce PDF error: Image not found or type unknown

Try setting: 'pdfAllowRemoteImages' => true, in your commerce.php config file.
Luke Holder's user avatar
  • 6,897
3 votes
Accepted

Eager loading on entry not reducing queries

I don't think eager loading will help in this case because you're trying to eager load fields with only a single relationship (asset). It's not the n+1 query problem eager loading is meant to solve. ...
Alex Roper's user avatar
  • 2,642
3 votes

How do I add Alt Image Tags to my photos?

An updated answer for 2023: Alternative Text is available to assets as a native field in Craft CMS 4. To enable it, within Settings > Media: Assets > Volumes > Field Layout, add the "...
franklylately's user avatar
3 votes
Accepted

How do you output the Image Caption on an asset?

You should give a try: {{ craft.assets.filename('refresh1.png').one().imageCaption }} Where imageCaption is the handle of your Image Caption field (imageCaption is an example, you should check this ...
Romain P.'s user avatar
  • 1,917
3 votes
Accepted

'png_compression_level should be an integer from 0 to 9' upon uploading image

This turned out to be a bug and the fix will be in the next release (current version is 3.5.15.1).
Oli's user avatar
  • 7,515
3 votes

Generating srcset in a similar way to WordPress

You can write a function, a utility template or a macro to make repetitive tasks like generating responsive images easier. I usually prefer templates, because they're easy to extend and they can take ...
MoritzLost's user avatar
  • 11.9k
3 votes

Repeated bottle shots on the home page

Ah, the familiar sight of repeating bottles on the homepage. It’s like déjà vu all over again. No need to worry, it sounds like just a “case” of forgotten placeholder code lingering around. Here’s how ...
Ben Croker's user avatar
  • 7,796
2 votes

Matrix field containing asset field blocks entry editing

Well, i found an answer. It seems it was caused by xdebug. All fields disappearing except 'Title' after saving Adding this to php.ini helped: xdebug.max_nesting_level=200
Peter Pe's user avatar
2 votes
Accepted

Using Focuspoint with eager loading

I ran into this issue too and had landed on this thread (and another similar one). I was able to piece together a solution using the modify elements query method. I wrote a pull request that got ...
Aaron Waldon's user avatar
2 votes

Photo demographic targeting in Craft?

I've used the Craft Geo Plugin for a project previously and it worked really well. It allowed us to serve specific content to detectable regions and areas, so that sounds like what you're after: ...
Stephen Hamilton's user avatar
2 votes
Accepted

Photo demographic targeting in Craft?

If I'm understanding you correctly, this is possible using the standard Craft Pro "locale" stuff. In addition to making text translatable, you can make Assets translatable - in which case you can ...
Matt Wilcox's user avatar
  • 3,229

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