Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
#1 2018-09-22 09:52:48
- jpdupont
- Member
- Registered: 2004-10-01
- Posts: 752
How test if an image (id) still exists before inserting
Hello,
I will have to review 500 images of which one third is not correct.
In order not to go over all the articles, and to modify the insertions of these bad images, I would like to test if an image id still exists before inserting it in an article. A kind of <txp:if_image>
…
I think to use <txp:evaluate>
on <txp:image id = "...">
but I don’t see how, and if is there a simpler solution?
Offline
Re: How test if an image (id) still exists before inserting
How about a big list of image
tags with a lo-fi table
wrapper? Untested:
<table>
<tr>
<td>1</td><td><txp:image id="1" /></td>
<td>2</td><td><txp:image id="2" /></td>
<td>3</td><td><txp:image id="3" /></td>
<td>4</td><td><txp:image id="4" /></td>
</tr>
</table>
Last edited by gaekwad (2018-09-22 14:31:59)
Offline
Re: How test if an image (id) still exists before inserting
<txp:images id="#,#,">
<txp:image />
<txp:images>
Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.
Offline
#4 2018-09-23 06:05:21
- jpdupont
- Member
- Registered: 2004-10-01
- Posts: 752
Re: How test if an image (id) still exists before inserting
Thank you for your answers.
@gaekwad I think I did not express myself well: The images are already introduced in the articles. I need to delete more than 100. How to make the display of a deleted image does not cause an error? The images are introduced by the article_image field. I would not have to go through all the articles to remove the IDs of the deleted images.
—> if_image_exist(“32”) then display it else do nothing.
@colak : fine, this way no error ! Thanks !
Offline
Re: How test if an image (id) still exists before inserting
jpdupont wrote #314136:
Thank you for your answers.
@gaekwad I think I did not express myself well: The images are already introduced in the articles. I need to delete more than 100. How to make the display of a deleted image does not cause an error? The images are introduced by the article_image field. I would not have to go through all the articles to remove the IDs of the deleted images.
—> if_image_exist(“32”) then display it else do nothing.
@colak : fine, this way no error ! Thanks !
If the above works, here’s another way that you can call the custom_field
<txp:images id='<txp:custom_field name="article_image" />'>
<txp:image />
</txp:images>
Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.
Offline
#6 2018-09-23 11:12:16
- jpdupont
- Member
- Registered: 2004-10-01
- Posts: 752
Re: How test if an image (id) still exists before inserting
Thanks, Yiannis !
Offline