Note that there are some explanatory texts on larger screens.

plurals
  1. POImages for my gallery and also thumbnails not created
    primarykey
    data
    text
    <p>I recently wrote here a similar post, but I had no result, I mean I found no solution for my problem at all.</p> <p>The problem is that I created a form for my website, to let users upload some images/photos etc.</p> <p>I'd like then to show them their images uploaded, as a gallery that's as thumbnails which are links to the photos in original dimensions.</p> <p>To do that, I created a table in my db this way:</p> <pre><code>CREATE TABLE uploaded (id_file INT(11) UNSIGNED NOT NULL AUTO_INCREMENT, url_file VARCHAR(50) NOT NULL, name_file VARCHAR(100) NOT NULL, type_file VARCHAR(20) NOT NULL, description VARCHAR(255), notes TEXT, data_insert DATETIME NOT NULL, address_IP CHAR(15) NOT NULL, username VARCHAR(20) NOT NULL, id_user INT(11) NOT NULL, PRIMARY KEY(id_file)); </code></pre> <p>I can have this way some important information upon the files uploaded, that I can use after in a page that I called <code>vision.php</code>.</p> <p>Here I simplify a lot my script. The strangest thing, apart from the fact that I'm not able to create to obtain the thumbnails with another script, called "thumb.php" that I pass in query string here, is <strong>that the thumbnail itself is a link that brings to nowhwere!.</strong></p> <p>As a matter of fact, although in the directory "uploaded" I see the image, I can't open that directory and, of course, that file.</p> <p>I'd like to say also that both the directory and the files there are set with:</p> <p>chmod 0777 and therefore in the right way.</p> <p>I use the PDO API to connect to my db and for all the queries, but I don't see any errors in that.</p> <p>Can anybody help me?</p> <p>Here is the source of my script called "vision.php":</p> <pre><code> &lt;php&gt; include 'config_db.php'; try { // Report all PHP errors error_reporting(-1); $pdo-&gt;setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); $stmt = $pdo-&gt;prepare("SELECT * FROM uploaded"); if ( $stmt-&gt;execute() ) { while ( $row = $stmt-&gt;fetch(PDO::FETCH_ASSOC) ) { echo '&lt;a href="uploaded/' . $row['name_file'] . '.' . $row['type_file'] . '" &gt;&lt;img src="thumb.php?id_file=' . $row['name_file'] . '" alt="' . $row['name_file'] . '" /&gt;&lt;/a&gt;'; } } catch (PDOException $e) { echo "Error!: " . $e-&gt;getMessage() . "&lt;br /&gt;"; die; } ?&gt; </code></pre>
    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.
 

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