Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to access local paths on TYPO3 using eID
    primarykey
    data
    text
    <p>I have an image map on my frontend and from there I need to access some images that are stored on different folders under the fileadmin directory. And I'm trying to do it with eID, following this example: [http://www.alexanderschnitzler.de/2011/06/howto-ajax-requests-with-extbase-and-fluid/][1]</p> <p>But my problem is that I can only access one directory. I haven't been able to access different directories based on the user selection from my front end.</p> <p>This is the code of what I been trying to do: <strong>On my Controller</strong> I have an ajaxAction, where I need to give the full path of one directory, because I haven't figure it out how pass the directory id on to my ajaxAction, here might be my question and maybe the solution:</p> <pre><code>/** * @return void */ public function ajaxAction() { $image_file_path = "fileadmin/Images/Sattic/Amik/small"; //$image_file_path = "fileadmin/Images/Sattic/'+$id+'"; $d = dir($image_file_path) or die("Wrong path: $image_file_path"); while (false !== ($entry = $d -&gt;read())) { if($entry != '.' &amp;&amp; $entry != '..' &amp;&amp; !is_dir($dir.$entry)) $images[] = $entry; } $d-&gt;close(); rsort($images); return json_encode($images); } </code></pre> <p>On my index.html I have a map tag where the function updateImage(id) is called, when the user clicks on the different areas and my updataImage(id) function looks like this:</p> <pre><code>function updateImageGallery(id) { console.log(id); var ajaxUrl = "{f:uri.action(action:'ajax', pageType:'100101')}"; $.getJSON(ajaxUrl, function(data) { var items1 = []; var items2 = []; $data = data; console.log('dataLength: ' + $data.length); console.log('dataArray: ' + $data); $.each($data.slice(0, 4), function(key, val) { valLink = val.replace("small.", ""); items1.push('&lt;td&gt;&lt;a href="fileadmin/Images/Sattic/' + id +'/'+ valLink +'" target="_blank"&gt;&lt;img width="145" height="145" id="" src="fileadmin/Images/Sattic/' + id +'/small/'+ val +'"/&gt;&lt;/a&gt;&lt;/td&gt;'); }); $('&lt;tr/&gt;', { html: items1.join('') }).appendTo('#glRegion'); $.each($data.slice(4, 8), function(key, val) { valLink = val.replace("small.", ""); items2.push('&lt;td&gt;&lt;a href="fileadmin/Images/Sattic/' + id +'/'+ valLink +'" target="_blank"&gt;&lt;img width="145" height="145" id="" src="fileadmin/Images/Sattic/' + id +'/small/'+ val +'"/&gt;&lt;/a&gt;&lt;/td&gt;'); }); $('&lt;tr/&gt;', { html: items2.join('') }).appendTo('#glRegion'); }); return false; </code></pre> <p>}</p> <p>I would like to be able to pass from updateImageGallery(id) function, the id of the directory, so I could get the images for each directory. </p> <p>Is it possible to do this? I hope so, I have 30 different regions and if I solve my problem the way I'm doing now I would need to use 30 different eID's. I guess it might be a smarter way to solve this.</p> <p>Any sugestions?</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload