snipt

Ctrl+h for KB shortcuts

MySQL

Extract image filepaths from a particular prog_gallery galery

SELECT f.filepath FROM prog_gallery_images gal_i JOIN node n ON n.nid=gal_i.i_nid JOIN image i ON i.nid=gal_i.i_nid JOIN files f ON f.fid=i.fid WHERE g_nid=352 AND i.image_size='_original'
https://snipt.net/embed/a061976420fd6e21363a2d5858b810da/
/raw/a061976420fd6e21363a2d5858b810da/
a061976420fd6e21363a2d5858b810da
mysql
MySQL
1
2019-05-16T17:54:17
True
False
False
/api/public/snipt/4888/
extract-image-filepaths-from-a-particular-prog_gallery-galery
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#L-1">1</a></pre></div></td><td class="code"><div class="highlight"><pre><span></span><span id="L-1"><a name="L-1"></a><span class="k">SELECT</span> <span class="n">f</span><span class="p">.</span><span class="n">filepath</span> <span class="k">FROM</span> <span class="n">prog_gallery_images</span> <span class="n">gal_i</span> <span class="k">JOIN</span> <span class="n">node</span> <span class="n">n</span> <span class="k">ON</span> <span class="n">n</span><span class="p">.</span><span class="n">nid</span><span class="o">=</span><span class="n">gal_i</span><span class="p">.</span><span class="n">i_nid</span> <span class="k">JOIN</span> <span class="n">image</span> <span class="n">i</span> <span class="k">ON</span> <span class="n">i</span><span class="p">.</span><span class="n">nid</span><span class="o">=</span><span class="n">gal_i</span><span class="p">.</span><span class="n">i_nid</span> <span class="k">JOIN</span> <span class="n">files</span> <span class="n">f</span> <span class="k">ON</span> <span class="n">f</span><span class="p">.</span><span class="n">fid</span><span class="o">=</span><span class="n">i</span><span class="p">.</span><span class="n">fid</span> <span class="k">WHERE</span> <span class="n">g_nid</span><span class="o">=</span><span class="mi">352</span> <span class="k">AND</span> <span class="n">i</span><span class="p">.</span><span class="n">image_size</span><span class="o">=</span><span class="s1">&#39;_original&#39;</span> </span></pre></div> </td></tr></table>
drupal, prog_gallery

SQL

Select images and galeries from Drupal Acidfree gallery

SELECT f.filepath,td.name FROM node n JOIN files f ON f.nid=n.nid JOIN term_node tn ON tn.nid=n.nid JOIN term_data td ON td.tid=tn.tid WHERE n.type='image' AND filename='_original' ORDER BY td.name
https://snipt.net/embed/25fa9dbfefeb17c93fec0e7d42ef3ce0/
/raw/25fa9dbfefeb17c93fec0e7d42ef3ce0/
25fa9dbfefeb17c93fec0e7d42ef3ce0
sql
SQL
1
2019-05-20T06:23:02
True
False
False
/api/public/snipt/3807/
select-images-and-galeries-from-drupal-acidfree-gallery
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#L-1">1</a></pre></div></td><td class="code"><div class="highlight"><pre><span></span><span id="L-1"><a name="L-1"></a><span class="k">SELECT</span> <span class="n">f</span><span class="p">.</span><span class="n">filepath</span><span class="p">,</span><span class="n">td</span><span class="p">.</span><span class="n">name</span> <span class="k">FROM</span> <span class="n">node</span> <span class="n">n</span> <span class="k">JOIN</span> <span class="n">files</span> <span class="n">f</span> <span class="k">ON</span> <span class="n">f</span><span class="p">.</span><span class="n">nid</span><span class="o">=</span><span class="n">n</span><span class="p">.</span><span class="n">nid</span> <span class="k">JOIN</span> <span class="n">term_node</span> <span class="n">tn</span> <span class="k">ON</span> <span class="n">tn</span><span class="p">.</span><span class="n">nid</span><span class="o">=</span><span class="n">n</span><span class="p">.</span><span class="n">nid</span> <span class="k">JOIN</span> <span class="n">term_data</span> <span class="n">td</span> <span class="k">ON</span> <span class="n">td</span><span class="p">.</span><span class="n">tid</span><span class="o">=</span><span class="n">tn</span><span class="p">.</span><span class="n">tid</span> <span class="k">WHERE</span> <span class="n">n</span><span class="p">.</span><span class="k">type</span><span class="o">=</span><span class="s1">&#39;image&#39;</span> <span class="k">AND</span> <span class="n">filename</span><span class="o">=</span><span class="s1">&#39;_original&#39;</span> <span class="k">ORDER</span> <span class="k">BY</span> <span class="n">td</span><span class="p">.</span><span class="n">name</span> </span></pre></div> </td></tr></table>
acidfree, drupal, sql