![]() |
|
file_exists - Printable Version +- ZenphotoCMS Forum (https://forum.zenphoto.org) +-- Forum: Support (https://forum.zenphoto.org/forum-1.html) +--- Forum: General support (https://forum.zenphoto.org/forum-4.html) +--- Thread: file_exists (/thread-3427.html) |
file_exists - MarcelSpijker - 2008-08-06 I am trying to make something to displays the histograms. Now i encounter the following problem: When i type the next line it shows the image: [img]/marcel/zenphoto/histograms/hist_[/img] ` When i use the next code it dousnt... ` $url = getFullImageURL(); $image = basename($url); $filenaam = "/marcel/zenphoto/histograms/hist_".$image; if (file_exists($filenaam)) { echo " file_exists - sbillard - 2008-08-06 The image URL is different from the image filename. Try file_exists - MarcelSpijker - 2008-08-06 There is one thing i forgot to tell: When i use: if (file_exists($filenaam)) { echo " file_exists - MarcelSpijker - 2008-08-06 ok, now the site shows correctly, but file_exists still dousnt see the img. I see the image if i do: $image = $_zp_current_image->filename; $filenaam = "/marcel/zenphoto/histograms/hist_".$image; echo ""; ` i do not see the image when i do: $image = $_zp_current_image->filename; $filenaam = "/marcel/zenphoto/histograms/hist_".$image; if (file_exists($filenaam)) { echo ""; }else{ echo "No histogram found."; } ` file_exists - MarcelSpijker - 2008-08-06 Well it works, it is (for me) strange: when i use path: /marcel/zenphoto/histograms/image.jpg it shows the image but file_exists dousnt see it! with file_exists i need to use: /home/marcelspijker.nl/www/marcel/zenphoto/histograms/image.jpg And then use the first url to show the image... Crazy! But how can i get this so it is usable in a plugin??? file_exists - acrylian - 2008-08-06 Did you try using our constants WEBPATH or FULLWEBPATH? file_exists - MarcelSpijker - 2008-08-06 But WEBPATH and FULLWEBPATH are for the current image yes? I want to make a plugin that has a folder next to the albums called histograms. file_exists - acrylian - 2008-08-06 WEBPATH and FULLWEBPATH are actually pretty general. On index.php WEBPAHT returns We have plugin tutorial on our user guide section. file_exists - MarcelSpijker - 2008-08-06 Thanks! The one i needed was SERVERPATH That did the trick. Next problem i have (and i hope somebody can help) is the following: if i echo the $source_file i see its the right image to make the histogram from, The script is started trough the themes image page: $url = getFullImageURL(); hist_makeHistogram($url, "474747"); ` Here is the beginning of the code: function hist_makeHistogram($image, $color) { set_time_limit(500); //HISTOGRAM VARIABLES global $cfgrow; $source_file = $cfgrow['imagepath'].$image; $maxheight = 100; $barwidth = 1; $iscolor = false; $im = ImageCreateFromJpeg($source_file); $imgw = imagesx($im); $imgh = imagesy($im); $n = $imgw*$imgh; $histo = array(); $histoR = array(); $histoG = array(); $histoB = array(); ` This function is located in plugin dir in file histogram.php and activated by plugintab in admin. file_exists - sbillard - 2008-08-06 what is Just a small note. Since Zenphoto supports image formates other than JPEG you might want to put a test in to see which kind of image you have and use the appropriate ImageCreateFromXXX function. file_exists - MarcelSpijker - 2008-08-07 I will try to make it fully compatible with all the img files zen supports. file_exists - MarcelSpijker - 2008-08-08 Update: It is working now perfectly I now have to cleanup the code and add the png and other extensions to work. shouldn't be to much work. To see it in work you can visit my website: http://www.marcelspijker.nl/marcel/zenphoto Maybe important, the histogram is created the first time somebody looks at the image, it saves it, so the next time somebody looks it will get the histogram from the server. Saves a lot of time. if i created the histograms for all images at one time the server runs out of mem or something... file_exists - sbillard - 2008-08-08 Nice site. I hope you will make your plugin available to the community. (I guess we will have to start a page for third party plugins to support this.) file_exists - acrylian - 2008-08-09 Marcel, if you provide a download link on your site I will add it to our plugins page (sbillard, we have already a plugins page!). Also you maybe would like to submit your site to the showcase! (btw the links and about pages don't work). file_exists - MarcelSpijker - 2008-08-09 I will make it available! I use Zenphoto with great pleasure, so now i can finaly do something back I know some links on the site dont work yet, this theme i also just put up, and have yet to make the pages, the archive is also one i have yet to do. When all is ready, and the plugin clean i will post the plugin and the theme here, so you can put it to the plugin page and the showcase. |