I try to use the phpthumbof modx addon in an getResources template chunk as a snippet, like shown in the code below. But it always gives me back this strange image with its version and the text "error messages disables" in red color and on a violet background.
Here my snippet call:
<img src="[[!phpthumbof? &input=`[[+tv.content__gallery__image]]` &options=`w=100&h100`]]" />
There is an error in your snippet call with the height property, try this:
<img src="[[!phpthumbof? &input=`[[+tv.content__gallery__image]]` &options=`w=100&h=100`]]" />
Next check that imageMagick is working properly on your server. That error sounds like a missing ImageMagick install.
P.S I would also recommend you to take a look at the pThump extra to replace phpthumbof. It does the same thing, but is a lot faster.
Related
I just got a problem using revolution slider in modx evolution.
My slider have jquery code
tabs: {
tmp:'<div class="tp-tab-content"> <span class="tp-tab-date">{{param1}}</span> <span class="tp-tab-title">{{title}}</span></div><div class="tp-tab-image"></div>'}
and modx of course parsing {{param1}} and {{title}} as chunks, but its part of revoslider's jquery.
so after parsign page html code looks like this
tabs: {
tmp:'<div class="tp-tab-content"> <span class="tp-tab-date"></span> <span class="tp-tab-title"></span></div><div class="tp-tab-image"></div>'}
and revolution slider shows incorrect
i tried calling revoslider code from html file using snipnet with php funtion include, but it also got parsed by modx engine
can i solve this problem without changing revoslider jquery code?
thanks to your ansewers!
I am not an EVO expert, but I could suggest several tricks that may help:
Try to escape the curly braces like \{\{param1\}\}
Try to breake the sequence like {[*fakeTemplateVar*]{param1}[*fakeTemplateVar*]}*
Try an empty TV like [*fakeTemplateVar*:ifempty={{param1}}]
*fakeTemplateVar will finally evaluate to an empty place in the template.
I'm trying to post a picture to a file on my Gitlab using markdown
![](test/media/screenshot.png)
seems to work but is far too large.
Other solutions I've tried and don't seem to work are as follows:
<img src="https://gitlab.com/example/screenshot" width="48">
![](test/media/screenshot.png =100x20)
![](test/media/screenshot.png =250x)
<img src="https://gitlab.com/example/screenshot" alt="Drawing" style="width: 200px;"/>
Any ideas on what I can do rather than re-sizing every image I have?
Raw HTML works
Try the following: after uploading your image, use img tag with src pointing to the path of uploaded image, for me it's working:
The following is from one of my files
![](/uploads/d19fcc3d3b4d313c8cd7960a343463b6/table.png)
<img src="/uploads/d19fcc3d3b4d313c8cd7960a343463b6/table.png" width="120" height="120">
Check this link, where I've put different size of same image https://gitlab.com/Basel.issmail/resize-image/wikis/resizing-image
There is an issue on gitlab discuss Add control over images with Markdown
GitLab 15.7 (December 2022) adds an official support for this:
Change the dimensions of images in Markdown
Before this release, there were no controls for changing the size
of images rendered within Markdown text areas.
This often led to unwieldy images with no control over how much space they took up in descriptions and comments.
You can now set the width and height of how images are rendered directly
in Markdown by appending the {width=x height=y} attributes to the image reference. Sizes can be specified with pixels or percentages.
See Documentation and Issue.
Following code give good result: (the URL set in tag is the one generated by Gitlab when attaching a image)
![]() <img src="/uploads/d19fcc3d3b4d313c8cd7960a343463b6/table.png" width="120">
It shows a clickable thumbail with a fixed width (and keep image ratio).
Newbie to modx and I am trying to build an image slider in Modx Revo. I am using Get resources but it does not output the template file. What am I doing wrong? This is my code:
[[getResources?
&resources=`[[*slide-img]]`
&parents=`-1`
&depth=`0`
&limit=`0`
&tpl=`slides`
&sortby=`FIELD(modResource.id,[[*slide-img]])`
&sortdir=`ASC`
&includeTVs=`1` &processTVs=`1` &tvPrefix=`tv.`
]]
From what I understand, you're trying to get all images from ressources in the resource tree. And show them in an image slider.
I guess you will have the javaScript for the image slider already present. So there is how to get the images.
You have a TV called slide-img, right? Good. Make sure it's output format is text.
If you refer to that image inside of a page that carries that TV, you call it like this
<img src="[[*slide-image]]" alt="some Image" />
If you call it in a chunk (what you will do when using getResources), you call the image like this:
<img src="[[+tv.slide-image]]" alt="some Image" />
See the difference? * is for the TV inside of the same page, + is the correct call for a placeholder. So if you're using getResources, it will put everything you query into the placeholders in your microtemplate (we call that chunk in MODX terms)
So your getResources call might look like this:
[[getResources?
&parents=`-1` (the place from where getResources will dig down the tree)
&depth=`0` (how deep will it dig?)
&limit=`0` (only the default 5? no! :) )
&tpl=`slides` (this is your chunk, right?)
&sortby=`FIELD(modResource.id,[[*slide-img]])` (you will sort by the file name and folder, is that right?)
&sortdir=`ASC`
&includeTVs=`1` &processTVs=`1` &tvPrefix=`tv.` (right, right, tv. is already the default value)
]]
getResources is a snippet used primarily to list documents, not images. A document (of type HTML, XML, CSS or JSON, to name a few) is created in the document tree in the manager and represents an example of a resource that you can get with getResources snippet.
Even if it is possible somehow to put an image as a document (which I doubt), it is not a common way anyway. Usually you want to attach an image to a document via template variable of corresponding type. For a slider particularly, you need many images, not one. So, you might need something specific like Gallery Extra to manage and output your images. Check out gallery section too. Note that basic version of MODX you have just installed isn't fully functional. We have to install extras to use MODX properly. Usually I install up to 30 extras.
Also your snippet call looks weird to me:
&resources=`[[*slide-img]]`
I don't know what the content of your template variable slide-img is but it should be a comma-separated list of resource ids like 2,4,6,34. Probably, in your case you have something different like image url and the snippet call silently crashes or just outputs nothing.
I'm using phpThumbOf on my site to generate resized images on my modx site. Now I tried to do a download area where I want to show some thumbnails of PDFs, but its not generating them. When I try to use pThumb, it returns the sourcefile path.
I already confirmed, that ImageMagick and php-imagick are installed and enabled.
Also my local development environment should allow to use exec so I can't see why this isn't working.
Did someone got this to work already?
Is Ghostscript running in your setup? It's needed to generate thumbnails of PDFs.
Source:
http://phpthumb.sourceforge.net/demo/docs/phpthumb.faq.txt
Quote:
Q: Can I make thumbnails from a PDF?
A: Yes, as long as you have both ImageMagick and GhostScript
installed. The AFPL version of GhostScript seems to work
better than the GNU version (at least for me it does).
http://www.imagemagick.org
http://www.cs.wisc.edu/~ghost/
You may want to use the "sfn" (Source Frame Number)
parameter of phpThumb to specify which page to thumbnail.
Use pThumb. It's the fork of phpThumbOf.
You say that you're already getting the image path (including the image?). You could put that into something like this:
<a href="[[+image:pthumb=`w=800&h=400&zc=0`]]" rel="lightbox" title="Click for enlagement" >
<img src="[[+image:pthumb=`w=150&h=150&zc=0`]]" />
</a>
Or whatever options you might want. It is always good practice to output the image TV's as text, so you have full control over the actual code.
hi I've made a simple module with CTLModuleMaker in CMS made simple, in the template I call the necessary items like this:
{assign var="item" value=$itemlist[0]}
{$item->name->Label()}: {$item->name}<br/>
{$item->image->Label()}: {$item->image}<br/>
{$item->image_text->Label()}: {$item->image_text}<br/>
{$item->image_desc->Label()}: {$item->image_desc}<br/>
{$item->img_thumb->Label()}: {$item->img_thumb}<br/>
{$item->catagory->Label()}: {$item->catagory}<br/>
as you can see i call an image with {$item->image} but when i try to do something like this {$item->url} it returns the url of the whole page I'm trying to get the url of the image not the whole page.
any suggestions what i can do??
In a news template, it calls
<img src="{$item->file_location}/{$item->image->value}" />
You can also use {debug} to see all the variables being passed to the template in a separate popup window. This is my get out of jail free card when I can't find a field name.