Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#11 2020-04-07 20:09:25

jakob
Admin
From: Germany
Registered: 2005-01-20
Posts: 3,810
Website

Re: Display single image from an article

code365 wrote #322541:

It’s uploading to the database because I see it in the Content->Images->then the folder I created for the images.

If you can see them correctly in Content › Images, then the solution above using <txp:image name='<txp:category />.jpg' /> should work. If your image is not a jpg, then replace the jpg with png, gif or whatever your image is.
If it’s still not showing, have a look at the source code in your browser and see what the link to the image shows in the source code. Compare that with the correct link to the working image and that may help you find what’s not working as intended.


TXP Builders – finely-crafted code, design and txp

Offline

#12 2020-04-08 04:44:57

colak
Admin
From: Cyprus
Registered: 2004-11-20
Posts: 7,905
Website

Re: Display single image from an article

code365 wrote #322538:

Anyway to show you a screenshot ?

Yes please! but also check Jakob’s post.


Yiannis
——————————
neme.org | hblack.net | LABS | State Machines | NeMe @ github | Covid-19; a resource
I do my best editing after I click on the submit button.

Offline

#13 2020-04-08 15:20:12

code365
Member
From: California
Registered: 2009-08-16
Posts: 69

Re: Display single image from an article

@Jakob I viewed the soure code in the browser, don’t see any string path from the image. Should it be <txp:image name=’<txp:category/>.jpg’/>

Could it be the version of txp (latest) I am using, maybe not. I look at the documentation for images tag.

I am using txp images upload tool.

Last edited by code365 (2020-04-09 03:59:13)

Offline

#14 2020-04-08 16:32:59

jakob
Admin
From: Germany
Registered: 2005-01-20
Posts: 3,810
Website

Re: Display single image from an article

code365 wrote #322550:

@Jakob I viewed the soure code in the browser, don’t see any string path from the image. Should it be <txp:images name=’<txp:category/>.jpg’/>

In this particular case it should be txp:image not image*s* (i.e. without the ‘s’): maybe that’s the reason nothing’s showing for you?

Also, you mention having folders in Content › Images but I’m not aware of a way to do that. Under Admin › Preferences › Admin you can set your own folder name for all the images instead of using the standard ‘images’ folder. Did you mean that?
Or did you mean perhaps smd_thumbnail? The idea of that is to provide more than two sizes of the same image. If you want a particular size of that image, you’ll need to use <txp:smd_thumbnail name='<txp:category />.jpg' type="your-prenamed-thumbnail-type" />.

If that’s not what you mean, I am perhaps misunderstanding you. This is the step-by-step of the method I suggested:

  1. Upload your image via the Content › Images panel (if not already done)
  2. Edit the image and under Image name in the image information block enter your category name (not the title) exactly as you have it already saved, with .jpg on the end if it is a .jpg. Then save the changes to the image.
  3. In your page template or form code, use what Colak suggested here.
  4. Visit your page in the browser. Make sure you navigate to the right menu item where the image should show. Can you see it?
  5. If it doesn’t, use the shortcut for your browser (as described here) to show the HTML source of the browser code. Have a look through it for the place where the image should appear.
    • If it worked, you should see <img src="path/to/image/your-category-name.jpg"> at the place where it should appear.
    • If the image is broken, you may see another path and may be able to work out why it’s working by comparing it with the working image link.
    • If you get nothing, check your code is working first, by outputting some text instead of the image, e.g. “CATEGORY IMAGE HERE”. If that appears, your code logic is correct. If not, check that first.
    • You can also try outputting <txp:image name='<txp:category />.jpg' /> at a place in your page template where no logic is involved to see if the image link is working.
    • If you still have no luck, try setting the Production status under Admin › Preferences › Site to Debugging and see if you get any error messages that might help you further.

Apologies if I have backtracked too far here, but I am just trying to make sure we’re not talking at cross purposes.


TXP Builders – finely-crafted code, design and txp

Offline

#15 2020-04-08 19:38:50

code365
Member
From: California
Registered: 2009-08-16
Posts: 69

Re: Display single image from an article

@jakob Thank you bro for the information.

Before I read your post I tried the tag below with the name of the image. That worked
<txp:image name=“adirondack-chair-set.jpg” />

I will follow your instructions to track what is going on.

Offline

#16 2020-04-09 10:26:15

jakob
Admin
From: Germany
Registered: 2005-01-20
Posts: 3,810
Website

Re: Display single image from an article

Glad it was just the images/image typo and you got it working, and apologies for going back to square 1.


TXP Builders – finely-crafted code, design and txp

Offline

#17 2020-04-09 14:37:00

code365
Member
From: California
Registered: 2009-08-16
Posts: 69

Re: Display single image from an article

Thank you for all your help Jakob
It only works when I type the name of the image.
<txp:image name=“adirondack-chair-set.jpg” />

If I use the category tag it will not work.
<txp:image name=’<txp:category />.jpg’ />

I think I will go back to the previous version.

Offline

#18 2020-04-10 05:37:09

colak
Admin
From: Cyprus
Registered: 2004-11-20
Posts: 7,905
Website

Re: Display single image from an article

code365 wrote #322564:

Thank you for all your help Jakob
It only works when I type the name of the image.
<txp:image name=“adirondack-chair-set.jpg” />

If I use the category tag it will not work.
<txp:image name=’<txp:category />.jpg’ />

I think I will go back to the previous version.

Is adirondack-chair-set the name of a category?


Yiannis
——————————
neme.org | hblack.net | LABS | State Machines | NeMe @ github | Covid-19; a resource
I do my best editing after I click on the submit button.

Offline

#19 2020-04-11 06:25:07

code365
Member
From: California
Registered: 2009-08-16
Posts: 69

Re: Display single image from an article

Yes, adirondack-chair-set is the name of a category. I think I have tried every image tag, just figure what is wrong.

If I put the name of the image it works <txp:image name=’adirondack-chair-set.jpg’ /> but when I use the category tag inside <txp:image name=’<txp:category />.jpg’ /> it will not work.

This what I did:

I went to content->categories->Images; created an image categories name adirondack-chair-set. I uploaded five images into adirondack-chair-set categories.

I followed the steps above, nothing still not working. It will not display the first image from the article out of the five.

Last edited by code365 (2020-04-11 06:34:26)

Offline

#20 2020-04-11 06:44:25

colak
Admin
From: Cyprus
Registered: 2004-11-20
Posts: 7,905
Website

Re: Display single image from an article

Is your site online? I could take a look in order to debug if you wish. Let me know and I’ll send you my email.


Yiannis
——————————
neme.org | hblack.net | LABS | State Machines | NeMe @ github | Covid-19; a resource
I do my best editing after I click on the submit button.

Offline

Board footer

Powered by FluxBB