Copy link to clipboard
Copied
Hi,
the issue is that i need to open .ai files in illustrator and am able to do that. what ever files that i open in illustrator, those should be opened in an extension which we developed, and i am able to do that. the below extension snippet.
Now whats the issue is when i edit an image in illustrator and and able to save them and not able to load to this newly saved files. it is always loading the old files. but if i close the illustrator and try loading it am able to load it successfully.
tried all the ways.
someone pleases help me with this.
Try replacing:
exportArtboard.fileName= unescape(base_filename.replace('/c/','/'));
With:
exportArtboard.fileName= unescape(base_filename.replace('/c/','/')) + "?stamp=" + Date.now();
Copy link to clipboard
Copied
moved to Illustrator SDK​
Copy link to clipboard
Copied
Thank you so much..
Copy link to clipboard
Copied
When you say "when i edit an image in illustrator", are you talking about linked/embedded images or any art object?
How does your plugin load the illustrator files? What happens if the user closes and then reopens the file in Illustrator after modifying it, do you get the modified version then?
Copy link to clipboard
Copied
1. when i edit an image in illustrator means its an art object i.e .ai image
2. how does my illustrator files: those files are first loaded into a folder and then to the extension.
3. i am not getting the modified version just closing and reopening the file but by closing the and opening the abode illustrator
Copy link to clipboard
Copied
https://forums.adobe.com/people/ananth+padmakarp64550037 wrote
2. how does my illustrator files: those files are first loaded into a folder and then to the extension.
So your extension has its own copy of the files? When do the files get loaded into the folder? Does your extension open the file in Illustrator when it opens an ai file, or does it do it in the background?
Copy link to clipboard
Copied
my extension doesnt have its own copy. when a .ai file is opened in illustrator first it gets placed in a local folder. now the images which are in folder are loded into the extension.
Copy link to clipboard
Copied
https://forums.adobe.com/people/ananth+padmakarp64550037 wrote
my extension doesnt have its own copy. when a .ai file is opened in illustrator first it gets placed in a local folder. now the images which are in folder are loded into the extension.
How does it get placed in a local folder? What code do you use to load the file into your extension?
Copy link to clipboard
Copied
the files which are opened in illustrator, we retrive the path of that file and create a .png extension for these files and are loaded to folder. and not by getting the paths for all the files in the folder as an object and we display it from html side using ng-repeat in image tag
Copy link to clipboard
Copied
So if the user modifies a file, you create a new version of the png file with the same name?
If so, your problem is probably that the html panel is not reloading the image because it is cached. Try saving the file with a different name or add a query string with a time stamp to the image src, e.g.
<html>
<head>
<script type="text/javascript">
function updateImages()
{
var noupdate = document.getElementById("noupdate");
noupdate.src = "test.png";
var willupdate = document.getElementById("willupdate");
willupdate.src = "test.png?stamp=" + Date.now();
}
</script>
</head>
<body>
<img id='noupdate' src='test.png'/>
<img id='willupdate' src='test.png' />
<button onclick="updateImages()">Update</button>
</body>
</html>
Load this web page in a folder that has an image called test.png. Then modify the test.png file and click the Update button on the web page.
Copy link to clipboard
Copied
Thanks for the suggestion bro. i have tried your logic in a different manner before adding time stamp. But whats the problem is our client don't want the time stamp included in the name of the file. They have given us some naming convention for the file. Thats why. i need some other solution.
Copy link to clipboard
Copied
You son't need to change the filename if you use the time stamp in the query string of the image src as shown in the example html.
Example:
File name: "test.png"
Image src: "test.png?stamp=1510128384"
Copy link to clipboard
Copied
could you please explain me a bit clear. i did assumed that code in a different way.
or else this is my gmail id: padmakar0000@gmail.com
Copy link to clipboard
Copied
What is your code that loads the image into the html panel?
Copy link to clipboard
Copied
when saved control jumps to jsx file and the function is below
and that prepares an object and the file name is used to link the image in image source. that looks like this.
Copy link to clipboard
Copied
Try replacing:
exportArtboard.fileName= unescape(base_filename.replace('/c/','/'));
With:
exportArtboard.fileName= unescape(base_filename.replace('/c/','/')) + "?stamp=" + Date.now();
Copy link to clipboard
Copied
tried adding the time stamp but its not loading into extension. showing empty page
Copy link to clipboard
Copied
I just tried adding a query string with a timestamp to an img src attribute in an Illustrator html panel and it worked fine, so you need to debug your application to see where it is going wrong.
Copy link to clipboard
Copied
that file name contains a path to the image that we want to show. and while binding the image the file name is converted base64
Copy link to clipboard
Copied
Why would you convert the file name to base64? Do you mean the contents of the file are converted to base64? If so, then I don't see why you have the update problem as the base64 will be different if the image has changed.
Copy link to clipboard
Copied
base64 conversion is just for storage purpose
Copy link to clipboard
Copied
So you mean the file contents and not the file name is converted. What is the code that does the base64 conversion? Does it include some form of caching based on the filename?
Copy link to clipboard
Copied
Bro, that worked fine. Thank you so much. There is a bug in that and that's the problem.Now its working fine.
Copy link to clipboard
Copied
And how did you get such an idea of adding time stamp to the image src..?
Copy link to clipboard
Copied
It's a trick I came up with a long time ago to solve a similar problem.