Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   Checking if an image is uploaded to the server (https://forums.graalonline.com/forums/showthread.php?t=134264276)

jamitsu89 08-21-2011 01:15 PM

Checking if an image is uploaded to the server
 
Hey,

Is it possible to check if an image is uploaded to the server?

For example,

PHP Code:

  ---
  new 
GuiShowImgCtrl("Ach_IconImage") {
    
0;
    
image "ach_image.png";
    
this.height this.width 32;
  }
  --- 

Then I require a check for if that image is uploaded, so that if it isn't I can set the image to "ach_noimage.png".

Thanks in advance,

Caleb.

Crow 08-21-2011 02:13 PM

You can use fileExists() on the serverside to see if the file is uploaded to the server. I think the function only takes a filename, not a full path to the file.

jamitsu89 08-21-2011 04:04 PM

Lovely. Thanks a lot.

salesman 08-21-2011 06:26 PM

I think there's function on the client to check image width and height which you might be able to use (an image that doesn't exist should have a width/height of 0)

cbk1994 08-21-2011 06:50 PM

Quote:

Originally Posted by salesman (Post 1664657)
I think there's function on the client to check image width and height which you might be able to use (an image that doesn't exist should have a width/height of 0)

There's getImgWidth and getImgHeight. They can be used on both serverside and clientside. If you use one of them clientside for a file that is uploaded on the server, but the client doesn't have, it will return zero and then start downloading the file, so it's not the best way to check if a file is on the server (you would have to check again when the file is downloaded).


All times are GMT +2. The time now is 06:38 AM.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.