Go Back   MarcomCentral (PTI) and FusionPro User Communities > Software-Related Talk > The JavaScript Library


Thread Tools Search this Thread Display Modes
Old February 1st, 2018, 12:34 PM
mjlongo mjlongo is offline
Junior Community Member
Join Date: Jul 2013
Location: Rochester NY
Posts: 47
Default Simple question for when a graphic file does not exist

I'm using the following code to return an inline graphic:

return CreateResource(Field("name") + ".pdf", "graphic");
It works fine. However, the customer did not supply every file necessary. When the file does not exist, I instead want to simply return the name field using an appropriate font.

So my question is pretty simple, how do you check that the graphic file indeed exists and if not, run a different set of code?

Reply With Quote
Old February 6th, 2018, 09:25 AM
ScottHillock ScottHillock is offline
Regular Contributor
Join Date: Mar 2010
Posts: 94
Default Re: Simple question for when a graphic file does not exist

I would do this by creating a text frame set on top of a graphic frame and use this:

Pic = CreateResource(Field("name") + ".pdf", "graphic", true);
if (Pic.exists){
	FindTextFrame("Text").suppress = true;
	return Pic;
	FindGraphicFrame("Image").suppress = true;
	return CreateResource("");
Reply With Quote

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

All times are GMT -7. The time now is 05:16 AM.

Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2023, Jelsoft Enterprises Ltd.
(c) 2011, PTI Marketing Technologies™, Inc.